@stamhoofd/structures
Advanced tools
Comparing version 1.1.3 to 1.1.4
@@ -7,2 +7,3 @@ import { AutoEncoder } from '@simonbackx/simple-encoding'; | ||
} | ||
export declare const GroupPatch: typeof AutoEncoder & (new () => import("@simonbackx/simple-encoding").AutoEncoderPatchType<Group>); | ||
//# sourceMappingURL=Group.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Group = void 0; | ||
exports.GroupPatch = exports.Group = void 0; | ||
const tslib_1 = require("tslib"); | ||
@@ -17,2 +17,3 @@ const simple_encoding_1 = require("@simonbackx/simple-encoding"); | ||
exports.Group = Group; | ||
exports.GroupPatch = Group.patchType(); | ||
//# sourceMappingURL=Group.js.map |
@@ -14,2 +14,3 @@ import { AutoEncoder } from '@simonbackx/simple-encoding'; | ||
} | ||
export declare const GroupSettingsPatch: typeof AutoEncoder & (new () => import("@simonbackx/simple-encoding").AutoEncoderPatchType<GroupSettings>); | ||
//# sourceMappingURL=GroupSettings.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.GroupSettings = void 0; | ||
exports.GroupSettingsPatch = exports.GroupSettings = void 0; | ||
const tslib_1 = require("tslib"); | ||
@@ -44,2 +44,3 @@ const simple_encoding_1 = require("@simonbackx/simple-encoding"); | ||
exports.GroupSettings = GroupSettings; | ||
exports.GroupSettingsPatch = GroupSettings.patchType(); | ||
//# sourceMappingURL=GroupSettings.js.map |
@@ -16,3 +16,11 @@ import { AutoEncoder } from '@simonbackx/simple-encoding'; | ||
} | ||
export declare const PatchOrganization: typeof AutoEncoder & (new () => import("@simonbackx/simple-encoding").AutoEncoderPatchType<Organization>); | ||
export declare class OrganizationSimple extends AutoEncoder { | ||
id: string; | ||
/** | ||
* Name of the organization you are creating | ||
*/ | ||
name: string; | ||
address: Address; | ||
} | ||
export declare const OrganizationPatch: typeof AutoEncoder & (new () => import("@simonbackx/simple-encoding").AutoEncoderPatchType<Organization>); | ||
//# sourceMappingURL=Organization.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.PatchOrganization = exports.Organization = void 0; | ||
exports.OrganizationPatch = exports.OrganizationSimple = exports.Organization = void 0; | ||
const tslib_1 = require("tslib"); | ||
@@ -35,3 +35,15 @@ const simple_encoding_1 = require("@simonbackx/simple-encoding"); | ||
exports.Organization = Organization; | ||
exports.PatchOrganization = Organization.patchType(); | ||
class OrganizationSimple extends simple_encoding_1.AutoEncoder { | ||
} | ||
tslib_1.__decorate([ | ||
simple_encoding_1.field({ decoder: simple_encoding_1.StringDecoder }) | ||
], OrganizationSimple.prototype, "id", void 0); | ||
tslib_1.__decorate([ | ||
simple_encoding_1.field({ decoder: simple_encoding_1.StringDecoder }) | ||
], OrganizationSimple.prototype, "name", void 0); | ||
tslib_1.__decorate([ | ||
simple_encoding_1.field({ decoder: Address_1.Address }) | ||
], OrganizationSimple.prototype, "address", void 0); | ||
exports.OrganizationSimple = OrganizationSimple; | ||
exports.OrganizationPatch = Organization.patchType(); | ||
//# sourceMappingURL=Organization.js.map |
import { AutoEncoder } from '@simonbackx/simple-encoding'; | ||
import { Group } from './Group'; | ||
export declare enum PermissionLevel { | ||
@@ -8,3 +7,3 @@ /** No access */ | ||
Read = "Read", | ||
/** Write and write all data, but not allowed to modify settings */ | ||
/** Read and write child data, but not allowed to modify settings */ | ||
Write = "Write", | ||
@@ -28,6 +27,6 @@ /** Full access */ | ||
groups: GroupPermissions[]; | ||
hasReadAccess(group: Group): boolean; | ||
hasWriteAccess(group: Group): boolean; | ||
hasFullAccess(group: Group): boolean; | ||
hasReadAccess(groupId?: string | null): boolean; | ||
hasWriteAccess(groupId?: string | null): boolean; | ||
hasFullAccess(groupId?: string | null): boolean; | ||
} | ||
//# sourceMappingURL=Permissions.d.ts.map |
@@ -12,3 +12,3 @@ "use strict"; | ||
PermissionLevel["Read"] = "Read"; | ||
/** Write and write all data, but not allowed to modify settings */ | ||
/** Read and write child data, but not allowed to modify settings */ | ||
PermissionLevel["Write"] = "Write"; | ||
@@ -28,3 +28,7 @@ /** Full access */ | ||
class Permissions extends simple_encoding_1.AutoEncoder { | ||
hasReadAccess(group) { | ||
constructor() { | ||
super(...arguments); | ||
this.groups = []; | ||
} | ||
hasReadAccess(groupId = null) { | ||
if (this.level != PermissionLevel.None) { | ||
@@ -34,3 +38,6 @@ // Has read access | ||
} | ||
const permission = this.groups.find(g => g.groupId === group.id); | ||
if (!groupId) { | ||
return false; | ||
} | ||
const permission = this.groups.find(g => g.groupId === groupId); | ||
if (permission) { | ||
@@ -43,3 +50,3 @@ if (permission.level != PermissionLevel.None) { | ||
} | ||
hasWriteAccess(group) { | ||
hasWriteAccess(groupId = null) { | ||
if (this.level == PermissionLevel.Write || this.level == PermissionLevel.Full) { | ||
@@ -49,3 +56,6 @@ // Has read access | ||
} | ||
const permission = this.groups.find(g => g.groupId === group.id); | ||
if (!groupId) { | ||
return false; | ||
} | ||
const permission = this.groups.find(g => g.groupId === groupId); | ||
if (permission) { | ||
@@ -58,3 +68,3 @@ if (permission.level == PermissionLevel.Write || permission.level == PermissionLevel.Full) { | ||
} | ||
hasFullAccess(group) { | ||
hasFullAccess(groupId = null) { | ||
if (this.level == PermissionLevel.Full) { | ||
@@ -64,3 +74,6 @@ // Has read access | ||
} | ||
const permission = this.groups.find(g => g.groupId === group.id); | ||
if (!groupId) { | ||
return false; | ||
} | ||
const permission = this.groups.find(g => g.groupId === groupId); | ||
if (permission) { | ||
@@ -67,0 +80,0 @@ if (permission.level == PermissionLevel.Full) { |
@@ -7,2 +7,3 @@ import { AutoEncoder } from '@simonbackx/simple-encoding'; | ||
} | ||
export declare const GroupPatch: typeof AutoEncoder & (new () => import("@simonbackx/simple-encoding").AutoEncoderPatchType<Group>); | ||
//# sourceMappingURL=Group.d.ts.map |
@@ -13,2 +13,3 @@ import { __decorate } from "tslib"; | ||
], Group.prototype, "settings", void 0); | ||
export const GroupPatch = Group.patchType(); | ||
//# sourceMappingURL=Group.js.map |
@@ -14,2 +14,3 @@ import { AutoEncoder } from '@simonbackx/simple-encoding'; | ||
} | ||
export declare const GroupSettingsPatch: typeof AutoEncoder & (new () => import("@simonbackx/simple-encoding").AutoEncoderPatchType<GroupSettings>); | ||
//# sourceMappingURL=GroupSettings.d.ts.map |
@@ -40,2 +40,3 @@ import { __decorate } from "tslib"; | ||
], GroupSettings.prototype, "maxBirthYear", void 0); | ||
export const GroupSettingsPatch = GroupSettings.patchType(); | ||
//# sourceMappingURL=GroupSettings.js.map |
@@ -16,3 +16,11 @@ import { AutoEncoder } from '@simonbackx/simple-encoding'; | ||
} | ||
export declare const PatchOrganization: typeof AutoEncoder & (new () => import("@simonbackx/simple-encoding").AutoEncoderPatchType<Organization>); | ||
export declare class OrganizationSimple extends AutoEncoder { | ||
id: string; | ||
/** | ||
* Name of the organization you are creating | ||
*/ | ||
name: string; | ||
address: Address; | ||
} | ||
export declare const OrganizationPatch: typeof AutoEncoder & (new () => import("@simonbackx/simple-encoding").AutoEncoderPatchType<Organization>); | ||
//# sourceMappingURL=Organization.d.ts.map |
@@ -31,3 +31,14 @@ import { __decorate } from "tslib"; | ||
], Organization.prototype, "groups", void 0); | ||
export const PatchOrganization = Organization.patchType(); | ||
export class OrganizationSimple extends AutoEncoder { | ||
} | ||
__decorate([ | ||
field({ decoder: StringDecoder }) | ||
], OrganizationSimple.prototype, "id", void 0); | ||
__decorate([ | ||
field({ decoder: StringDecoder }) | ||
], OrganizationSimple.prototype, "name", void 0); | ||
__decorate([ | ||
field({ decoder: Address }) | ||
], OrganizationSimple.prototype, "address", void 0); | ||
export const OrganizationPatch = Organization.patchType(); | ||
//# sourceMappingURL=Organization.js.map |
import { AutoEncoder } from '@simonbackx/simple-encoding'; | ||
import { Group } from './Group'; | ||
export declare enum PermissionLevel { | ||
@@ -8,3 +7,3 @@ /** No access */ | ||
Read = "Read", | ||
/** Write and write all data, but not allowed to modify settings */ | ||
/** Read and write child data, but not allowed to modify settings */ | ||
Write = "Write", | ||
@@ -28,6 +27,6 @@ /** Full access */ | ||
groups: GroupPermissions[]; | ||
hasReadAccess(group: Group): boolean; | ||
hasWriteAccess(group: Group): boolean; | ||
hasFullAccess(group: Group): boolean; | ||
hasReadAccess(groupId?: string | null): boolean; | ||
hasWriteAccess(groupId?: string | null): boolean; | ||
hasFullAccess(groupId?: string | null): boolean; | ||
} | ||
//# sourceMappingURL=Permissions.d.ts.map |
@@ -9,3 +9,3 @@ import { __decorate } from "tslib"; | ||
PermissionLevel["Read"] = "Read"; | ||
/** Write and write all data, but not allowed to modify settings */ | ||
/** Read and write child data, but not allowed to modify settings */ | ||
PermissionLevel["Write"] = "Write"; | ||
@@ -24,3 +24,7 @@ /** Full access */ | ||
export class Permissions extends AutoEncoder { | ||
hasReadAccess(group) { | ||
constructor() { | ||
super(...arguments); | ||
this.groups = []; | ||
} | ||
hasReadAccess(groupId = null) { | ||
if (this.level != PermissionLevel.None) { | ||
@@ -30,3 +34,6 @@ // Has read access | ||
} | ||
const permission = this.groups.find(g => g.groupId === group.id); | ||
if (!groupId) { | ||
return false; | ||
} | ||
const permission = this.groups.find(g => g.groupId === groupId); | ||
if (permission) { | ||
@@ -39,3 +46,3 @@ if (permission.level != PermissionLevel.None) { | ||
} | ||
hasWriteAccess(group) { | ||
hasWriteAccess(groupId = null) { | ||
if (this.level == PermissionLevel.Write || this.level == PermissionLevel.Full) { | ||
@@ -45,3 +52,6 @@ // Has read access | ||
} | ||
const permission = this.groups.find(g => g.groupId === group.id); | ||
if (!groupId) { | ||
return false; | ||
} | ||
const permission = this.groups.find(g => g.groupId === groupId); | ||
if (permission) { | ||
@@ -54,3 +64,3 @@ if (permission.level == PermissionLevel.Write || permission.level == PermissionLevel.Full) { | ||
} | ||
hasFullAccess(group) { | ||
hasFullAccess(groupId = null) { | ||
if (this.level == PermissionLevel.Full) { | ||
@@ -60,3 +70,6 @@ // Has read access | ||
} | ||
const permission = this.groups.find(g => g.groupId === group.id); | ||
if (!groupId) { | ||
return false; | ||
} | ||
const permission = this.groups.find(g => g.groupId === groupId); | ||
if (permission) { | ||
@@ -63,0 +76,0 @@ if (permission.level == PermissionLevel.Full) { |
{ | ||
"name": "@stamhoofd/structures", | ||
"version": "1.1.3", | ||
"version": "1.1.4", | ||
"main": "./dist/index.js", | ||
@@ -5,0 +5,0 @@ "module": "./esm/dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
143565
2054