easywork-common-lib 1.0.1022 → 1.0.1024
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common/enums/common.enum.d.ts +14 -0
- package/dist/common/enums/common.enum.js +17 -1
- package/dist/common/enums/common.enum.js.map +1 -1
- package/dist/entities/all-activities.entity.d.ts +38 -0
- package/dist/entities/all-activities.entity.js +261 -0
- package/dist/entities/all-activities.entity.js.map +1 -0
- package/dist/entities/index.d.ts +1 -0
- package/dist/entities/index.js +1 -0
- package/dist/entities/index.js.map +1 -1
- package/dist/modules/authorization/authorization.module.d.ts +26 -0
- package/dist/modules/authorization/authorization.module.js +105 -0
- package/dist/modules/authorization/authorization.module.js.map +1 -0
- package/dist/modules/authorization/config/resource-configurations.d.ts +12 -0
- package/dist/modules/authorization/config/resource-configurations.js +124 -0
- package/dist/modules/authorization/config/resource-configurations.js.map +1 -0
- package/dist/modules/authorization/decorators/contact-permissions.decorator.d.ts +13 -0
- package/dist/modules/authorization/decorators/contact-permissions.decorator.js +101 -0
- package/dist/modules/authorization/decorators/contact-permissions.decorator.js.map +1 -0
- package/dist/modules/authorization/decorators/permissions.decorator.d.ts +51 -0
- package/dist/modules/authorization/decorators/permissions.decorator.js +144 -0
- package/dist/modules/authorization/decorators/permissions.decorator.js.map +1 -0
- package/dist/modules/authorization/factories/resource-authorization.factory.d.ts +55 -0
- package/dist/modules/authorization/factories/resource-authorization.factory.js +184 -0
- package/dist/modules/authorization/factories/resource-authorization.factory.js.map +1 -0
- package/dist/modules/authorization/index.d.ts +7 -0
- package/dist/modules/authorization/index.js +24 -0
- package/dist/modules/authorization/index.js.map +1 -0
- package/dist/modules/authorization/interfaces/authorization.interface.d.ts +23 -0
- package/dist/modules/authorization/interfaces/authorization.interface.js +3 -0
- package/dist/modules/authorization/interfaces/authorization.interface.js.map +1 -0
- package/dist/modules/authorization/services/authorization.service.d.ts +25 -0
- package/dist/modules/authorization/services/authorization.service.js +139 -0
- package/dist/modules/authorization/services/authorization.service.js.map +1 -0
- package/dist/modules/authorization/services/dynamic-filter.service.d.ts +9 -0
- package/dist/modules/authorization/services/dynamic-filter.service.js +238 -0
- package/dist/modules/authorization/services/dynamic-filter.service.js.map +1 -0
- package/dist/modules/authorization/services/index.d.ts +7 -0
- package/dist/modules/authorization/services/index.js +24 -0
- package/dist/modules/authorization/services/index.js.map +1 -0
- package/dist/modules/authorization/services/modules/contact-authorization.service.d.ts +29 -0
- package/dist/modules/authorization/services/modules/contact-authorization.service.js +105 -0
- package/dist/modules/authorization/services/modules/contact-authorization.service.js.map +1 -0
- package/dist/modules/authorization/services/modules/index.d.ts +4 -0
- package/dist/modules/authorization/services/modules/index.js +21 -0
- package/dist/modules/authorization/services/modules/index.js.map +1 -0
- package/dist/modules/authorization/services/modules/lead-authorization.service.d.ts +27 -0
- package/dist/modules/authorization/services/modules/lead-authorization.service.js +96 -0
- package/dist/modules/authorization/services/modules/lead-authorization.service.js.map +1 -0
- package/dist/modules/authorization/services/modules/policy-authorization.service.d.ts +28 -0
- package/dist/modules/authorization/services/modules/policy-authorization.service.js +100 -0
- package/dist/modules/authorization/services/modules/policy-authorization.service.js.map +1 -0
- package/dist/modules/authorization/services/modules/task-authorization.service.d.ts +28 -0
- package/dist/modules/authorization/services/modules/task-authorization.service.js +100 -0
- package/dist/modules/authorization/services/modules/task-authorization.service.js.map +1 -0
- package/dist/modules/authorization/services/permission-cache.service.d.ts +10 -0
- package/dist/modules/authorization/services/permission-cache.service.js +48 -0
- package/dist/modules/authorization/services/permission-cache.service.js.map +1 -0
- package/dist/modules/authorization/services/permission-evaluator.service.d.ts +26 -0
- package/dist/modules/authorization/services/permission-evaluator.service.js +349 -0
- package/dist/modules/authorization/services/permission-evaluator.service.js.map +1 -0
- package/dist/modules/authorization/services/resource-access-filter.service.d.ts +20 -0
- package/dist/modules/authorization/services/resource-access-filter.service.js +406 -0
- package/dist/modules/authorization/services/resource-access-filter.service.js.map +1 -0
- package/dist/modules/authorization/services/resource-authorization.service.d.ts +47 -0
- package/dist/modules/authorization/services/resource-authorization.service.js +192 -0
- package/dist/modules/authorization/services/resource-authorization.service.js.map +1 -0
- package/dist/modules/index.d.ts +1 -0
- package/dist/modules/index.js +1 -0
- package/dist/modules/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource-configurations.js","sourceRoot":"","sources":["../../../../src/modules/authorization/config/resource-configurations.ts"],"names":[],"mappings":";;;AAwHA,8CAMC;AAKD,gDAGC;AAKD,4CAGC;AAKD,sDAEC;AA7IY,QAAA,uBAAuB,GAAmB;IACrD,IAAI,EAAE,SAAS;IACf,UAAU,EAAE,SAAS;IACrB,cAAc,EAAE;QACd,UAAU,EAAE,cAAc;QAC1B,SAAS,EAAE,YAAY;QACvB,SAAS,EAAE,aAAa;QACxB,OAAO,EAAE,SAAS;QAClB,UAAU,EAAE,YAAY;KACzB;IACD,cAAc,EAAE;QACd,OAAO,EAAE,IAAI;QACb,aAAa,EAAE,YAAY;KAC5B;CACF,CAAA;AAEY,QAAA,oBAAoB,GAAmB;IAClD,IAAI,EAAE,MAAM;IACZ,UAAU,EAAE,MAAM;IAClB,cAAc,EAAE;QACd,UAAU,EAAE,cAAc;QAC1B,SAAS,EAAE,UAAU;QACrB,SAAS,EAAE,aAAa;QACxB,OAAO,EAAE,SAAS;QAClB,UAAU,EAAE,YAAY;KACzB;IACD,cAAc,EAAE;QACd,OAAO,EAAE,IAAI;QACb,aAAa,EAAE,YAAY;KAC5B;CACF,CAAA;AAEY,QAAA,sBAAsB,GAAmB;IACpD,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,QAAQ;IACpB,cAAc,EAAE;QACd,UAAU,EAAE,cAAc;QAC1B,SAAS,EAAE,WAAW;QACtB,SAAS,EAAE,aAAa;QACxB,OAAO,EAAE,SAAS;QAClB,UAAU,EAAE,YAAY;KACzB;IACD,cAAc,EAAE;QACd,OAAO,EAAE,IAAI;Q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ACpD,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,yCAAyC,YAAY,EAAE,CAAC,CAAA;IAC1E,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC;AAKD,SAAgB,kBAAkB,CAAC,YAAoB;IACrD,MAAM,MAAM,GAAG,iBAAiB,CAAC,YAAY,CAAC,CAAA;IAC9C,OAAO,MAAM,CAAC,cAAc,EAAE,OAAO,IAAI,KAAK,CAAA;AAChD,CAAC;AAKD,SAAgB,gBAAgB,CAAC,YAAoB,EAAE,YAAoD;IACzG,MAAM,MAAM,GAAG,iBAAiB,CAAC,YAAY,CAAC,CAAA;IAC9C,OAAO,MAAM,CAAC,cAAc,CAAC,YAAY,CAAC,IAAI,YAAY,CAAA;AAC5D,CAAC;AAKD,SAAgB,qBAAqB;IACnC,OAAO,MAAM,CAAC,IAAI,CAAC,+BAAuB,CAAC,CAAA;AAC7C,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare class ContactAuthPermissions {
|
|
2
|
+
static CanCreateContact(): <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
3
|
+
static CanReadContact(): <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
4
|
+
static CanUpdateContact(): <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
5
|
+
static CanDeleteContact(): <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
6
|
+
static CanMergeContacts(): <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
7
|
+
static CanBatchOperateContacts(): <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
8
|
+
static CanExportContacts(): <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
9
|
+
static CanImportContacts(): <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
10
|
+
static CanAssignContacts(): <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
11
|
+
static CanManageContactFiles(): <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
12
|
+
static CanReadAndAssign(): <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ContactAuthPermissions = void 0;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
const common_2 = require("../../../common/");
|
|
6
|
+
const permissions_decorator_1 = require("./permissions.decorator");
|
|
7
|
+
class ContactAuthPermissions {
|
|
8
|
+
static CanCreateContact() {
|
|
9
|
+
return (0, permissions_decorator_1.RequirePermissions)({
|
|
10
|
+
action: common_2.PermissionAction.CREATE,
|
|
11
|
+
scope: common_2.PermissionScope.GROUP,
|
|
12
|
+
resource: "contact",
|
|
13
|
+
conditions: [common_2.PermissionCondition.ALWAYS],
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
static CanReadContact() {
|
|
17
|
+
return (0, permissions_decorator_1.RequirePermissions)({
|
|
18
|
+
action: common_2.PermissionAction.READ,
|
|
19
|
+
scope: common_2.PermissionScope.GROUP,
|
|
20
|
+
resource: "contact",
|
|
21
|
+
conditions: [common_2.PermissionCondition.ALWAYS],
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
static CanUpdateContact() {
|
|
25
|
+
return (0, permissions_decorator_1.RequirePermissions)({
|
|
26
|
+
action: common_2.PermissionAction.UPDATE,
|
|
27
|
+
scope: common_2.PermissionScope.ASSIGNED,
|
|
28
|
+
resource: "contact",
|
|
29
|
+
conditions: [common_2.PermissionCondition.OWNER, common_2.PermissionCondition.ASSIGNED_TO],
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
static CanDeleteContact() {
|
|
33
|
+
return (0, permissions_decorator_1.RequirePermissions)({
|
|
34
|
+
action: common_2.PermissionAction.DELETE,
|
|
35
|
+
scope: common_2.PermissionScope.OWN,
|
|
36
|
+
resource: "contact",
|
|
37
|
+
conditions: [common_2.PermissionCondition.OWNER],
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
static CanMergeContacts() {
|
|
41
|
+
return (0, permissions_decorator_1.RequirePermissions)({
|
|
42
|
+
action: common_2.PermissionAction.MANAGE,
|
|
43
|
+
scope: common_2.PermissionScope.GROUP,
|
|
44
|
+
resource: "contact",
|
|
45
|
+
conditions: [common_2.PermissionCondition.ROLE_LEVEL],
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
static CanBatchOperateContacts() {
|
|
49
|
+
return (0, permissions_decorator_1.RequirePermissions)({
|
|
50
|
+
action: common_2.PermissionAction.MANAGE,
|
|
51
|
+
scope: common_2.PermissionScope.GROUP,
|
|
52
|
+
resource: "contact",
|
|
53
|
+
conditions: [common_2.PermissionCondition.ROLE_LEVEL],
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
static CanExportContacts() {
|
|
57
|
+
return (0, permissions_decorator_1.RequirePermissions)({
|
|
58
|
+
action: common_2.PermissionAction.EXPORT,
|
|
59
|
+
scope: common_2.PermissionScope.ASSIGNED,
|
|
60
|
+
resource: "contact",
|
|
61
|
+
conditions: [common_2.PermissionCondition.ALWAYS],
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
static CanImportContacts() {
|
|
65
|
+
return (0, permissions_decorator_1.RequirePermissions)({
|
|
66
|
+
action: common_2.PermissionAction.IMPORT,
|
|
67
|
+
scope: common_2.PermissionScope.GROUP,
|
|
68
|
+
resource: "contact",
|
|
69
|
+
conditions: [common_2.PermissionCondition.ROLE_LEVEL],
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
static CanAssignContacts() {
|
|
73
|
+
return (0, permissions_decorator_1.RequirePermissions)({
|
|
74
|
+
action: common_2.PermissionAction.ASSIGN,
|
|
75
|
+
scope: common_2.PermissionScope.GROUP,
|
|
76
|
+
resource: "contact",
|
|
77
|
+
conditions: [common_2.PermissionCondition.ROLE_LEVEL],
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
static CanManageContactFiles() {
|
|
81
|
+
return (0, permissions_decorator_1.RequirePermissions)({
|
|
82
|
+
action: common_2.PermissionAction.MANAGE,
|
|
83
|
+
scope: common_2.PermissionScope.ASSIGNED,
|
|
84
|
+
resource: "contact",
|
|
85
|
+
conditions: [common_2.PermissionCondition.OWNER, common_2.PermissionCondition.ASSIGNED_TO],
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
static CanReadAndAssign() {
|
|
89
|
+
return (0, common_1.applyDecorators)((0, permissions_decorator_1.RequirePermissions)({
|
|
90
|
+
action: common_2.PermissionAction.READ,
|
|
91
|
+
scope: common_2.PermissionScope.ASSIGNED,
|
|
92
|
+
resource: "contact",
|
|
93
|
+
}, {
|
|
94
|
+
action: common_2.PermissionAction.ASSIGN,
|
|
95
|
+
scope: common_2.PermissionScope.GROUP,
|
|
96
|
+
resource: "contact",
|
|
97
|
+
}));
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
exports.ContactAuthPermissions = ContactAuthPermissions;
|
|
101
|
+
//# sourceMappingURL=contact-permissions.decorator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contact-permissions.decorator.js","sourceRoot":"","sources":["../../../../src/mod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/B,QAAQ,EAAE,SAAS;YACnB,UAAU,EAAE,CAAC,4BAAmB,CAAC,KAAK,EAAE,4BAAmB,CAAC,WAAW,CAAC;SACzE,CAAC,CAAC;IACL,CAAC;IAMD,MAAM,CAAC,gBAAgB;QACrB,OAAO,IAAA,wBAAe,EACpB,IAAA,0CAAkB,EAChB;YACE,MAAM,EAAE,yBAAgB,CAAC,IAAI;YAC7B,KAAK,EAAE,wBAAe,CAAC,QAAQ;YAC/B,QAAQ,EAAE,SAAS;SACpB,EACD;YACE,MAAM,EAAE,yBAAgB,CAAC,MAAM;YAC/B,KAAK,EAAE,wBAAe,CAAC,KAAK;YAC5B,QAAQ,EAAE,SAAS;SACpB,CACF,CACF,CAAC;IACJ,CAAC;CACF;AA9ID,wDA8IC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { PermissionAction, PermissionScope } from "../../../common/";
|
|
2
|
+
export declare const PERMISSIONS_KEY = "permissions";
|
|
3
|
+
export declare const PERMISSION_RESOURCE_KEY = "permission_resource";
|
|
4
|
+
export declare const PERMISSION_CONTEXT_KEY = "permission_context";
|
|
5
|
+
export interface PermissionConfig {
|
|
6
|
+
action: PermissionAction;
|
|
7
|
+
scope?: PermissionScope;
|
|
8
|
+
resource?: string;
|
|
9
|
+
conditions?: string[];
|
|
10
|
+
bypassFor?: string[];
|
|
11
|
+
}
|
|
12
|
+
export declare const RequirePermissions: (...permissions: PermissionConfig[]) => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
13
|
+
export declare const PermissionResource: (resource: string) => import("@nestjs/common").CustomDecorator<string>;
|
|
14
|
+
export declare const PermissionContext: (context: Record<string, any>) => import("@nestjs/common").CustomDecorator<string>;
|
|
15
|
+
export declare const CanCreate: (scope?: PermissionScope, conditions?: string[]) => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
16
|
+
export declare const CanRead: (scope?: PermissionScope, conditions?: string[]) => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
17
|
+
export declare const CanUpdate: (scope?: PermissionScope, conditions?: string[]) => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
18
|
+
export declare const CanDelete: (scope?: PermissionScope, conditions?: string[]) => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
19
|
+
export declare const CanManage: (scope?: PermissionScope, conditions?: string[]) => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
20
|
+
export declare const CanAssign: (scope?: PermissionScope, conditions?: string[]) => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
21
|
+
export declare const CanExport: (scope?: PermissionScope, conditions?: string[]) => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
22
|
+
export declare const CanImport: (scope?: PermissionScope, conditions?: string[]) => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
23
|
+
export declare const CanApprove: (scope?: PermissionScope, conditions?: string[]) => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
24
|
+
export declare const CanCreateAndRead: (scope?: PermissionScope) => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
25
|
+
export declare const CanReadAndUpdate: (scope?: PermissionScope) => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
26
|
+
export declare const CanFullAccess: (scope?: PermissionScope) => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
27
|
+
export declare const ContactPermissions: {
|
|
28
|
+
CanCreateContact: () => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
29
|
+
CanReadContact: () => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
30
|
+
CanUpdateContact: () => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
31
|
+
CanDeleteContact: () => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
32
|
+
CanManageContacts: () => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
33
|
+
CanMergeContacts: () => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
34
|
+
CanExportContacts: () => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
35
|
+
};
|
|
36
|
+
export declare const LeadPermissions: {
|
|
37
|
+
CanCreateLead: () => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
38
|
+
CanReadLead: () => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
39
|
+
CanUpdateLead: () => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
40
|
+
CanDeleteLead: () => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
41
|
+
CanConvertLead: () => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
42
|
+
CanCancelLead: () => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
43
|
+
};
|
|
44
|
+
export declare const PolicyPermissions: {
|
|
45
|
+
CanCreatePolicy: () => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
46
|
+
CanReadPolicy: () => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
47
|
+
CanUpdatePolicy: () => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
48
|
+
CanDeletePolicy: () => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
49
|
+
CanCancelPolicy: () => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
50
|
+
CanApprovePolicy: () => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
51
|
+
};
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PolicyPermissions = exports.LeadPermissions = exports.ContactPermissions = exports.CanFullAccess = exports.CanReadAndUpdate = exports.CanCreateAndRead = exports.CanApprove = exports.CanImport = exports.CanExport = exports.CanAssign = exports.CanManage = exports.CanDelete = exports.CanUpdate = exports.CanRead = exports.CanCreate = exports.PermissionContext = exports.PermissionResource = exports.RequirePermissions = exports.PERMISSION_CONTEXT_KEY = exports.PERMISSION_RESOURCE_KEY = exports.PERMISSIONS_KEY = void 0;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
const common_2 = require("../../../common/");
|
|
6
|
+
exports.PERMISSIONS_KEY = "permissions";
|
|
7
|
+
exports.PERMISSION_RESOURCE_KEY = "permission_resource";
|
|
8
|
+
exports.PERMISSION_CONTEXT_KEY = "permission_context";
|
|
9
|
+
const RequirePermissions = (...permissions) => {
|
|
10
|
+
return (0, common_1.applyDecorators)((0, common_1.SetMetadata)(exports.PERMISSIONS_KEY, permissions));
|
|
11
|
+
};
|
|
12
|
+
exports.RequirePermissions = RequirePermissions;
|
|
13
|
+
const PermissionResource = (resource) => {
|
|
14
|
+
return (0, common_1.SetMetadata)(exports.PERMISSION_RESOURCE_KEY, resource);
|
|
15
|
+
};
|
|
16
|
+
exports.PermissionResource = PermissionResource;
|
|
17
|
+
const PermissionContext = (context) => {
|
|
18
|
+
return (0, common_1.SetMetadata)(exports.PERMISSION_CONTEXT_KEY, context);
|
|
19
|
+
};
|
|
20
|
+
exports.PermissionContext = PermissionContext;
|
|
21
|
+
const CanCreate = (scope, conditions) => {
|
|
22
|
+
return (0, exports.RequirePermissions)({
|
|
23
|
+
action: common_2.PermissionAction.CREATE,
|
|
24
|
+
scope,
|
|
25
|
+
conditions,
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
exports.CanCreate = CanCreate;
|
|
29
|
+
const CanRead = (scope, conditions) => {
|
|
30
|
+
return (0, exports.RequirePermissions)({
|
|
31
|
+
action: common_2.PermissionAction.READ,
|
|
32
|
+
scope,
|
|
33
|
+
conditions,
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
exports.CanRead = CanRead;
|
|
37
|
+
const CanUpdate = (scope, conditions) => {
|
|
38
|
+
return (0, exports.RequirePermissions)({
|
|
39
|
+
action: common_2.PermissionAction.UPDATE,
|
|
40
|
+
scope,
|
|
41
|
+
conditions,
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
exports.CanUpdate = CanUpdate;
|
|
45
|
+
const CanDelete = (scope, conditions) => {
|
|
46
|
+
return (0, exports.RequirePermissions)({
|
|
47
|
+
action: common_2.PermissionAction.DELETE,
|
|
48
|
+
scope,
|
|
49
|
+
conditions,
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
exports.CanDelete = CanDelete;
|
|
53
|
+
const CanManage = (scope, conditions) => {
|
|
54
|
+
return (0, exports.RequirePermissions)({
|
|
55
|
+
action: common_2.PermissionAction.MANAGE,
|
|
56
|
+
scope,
|
|
57
|
+
conditions,
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
exports.CanManage = CanManage;
|
|
61
|
+
const CanAssign = (scope, conditions) => {
|
|
62
|
+
return (0, exports.RequirePermissions)({
|
|
63
|
+
action: common_2.PermissionAction.ASSIGN,
|
|
64
|
+
scope,
|
|
65
|
+
conditions,
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
exports.CanAssign = CanAssign;
|
|
69
|
+
const CanExport = (scope, conditions) => {
|
|
70
|
+
return (0, exports.RequirePermissions)({
|
|
71
|
+
action: common_2.PermissionAction.EXPORT,
|
|
72
|
+
scope,
|
|
73
|
+
conditions,
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
exports.CanExport = CanExport;
|
|
77
|
+
const CanImport = (scope, conditions) => {
|
|
78
|
+
return (0, exports.RequirePermissions)({
|
|
79
|
+
action: common_2.PermissionAction.IMPORT,
|
|
80
|
+
scope,
|
|
81
|
+
conditions,
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
exports.CanImport = CanImport;
|
|
85
|
+
const CanApprove = (scope, conditions) => {
|
|
86
|
+
return (0, exports.RequirePermissions)({
|
|
87
|
+
action: common_2.PermissionAction.APPROVE,
|
|
88
|
+
scope,
|
|
89
|
+
conditions,
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
exports.CanApprove = CanApprove;
|
|
93
|
+
const CanCreateAndRead = (scope) => {
|
|
94
|
+
return (0, exports.RequirePermissions)({ action: common_2.PermissionAction.CREATE, scope }, { action: common_2.PermissionAction.READ, scope });
|
|
95
|
+
};
|
|
96
|
+
exports.CanCreateAndRead = CanCreateAndRead;
|
|
97
|
+
const CanReadAndUpdate = (scope) => {
|
|
98
|
+
return (0, exports.RequirePermissions)({ action: common_2.PermissionAction.READ, scope }, { action: common_2.PermissionAction.UPDATE, scope });
|
|
99
|
+
};
|
|
100
|
+
exports.CanReadAndUpdate = CanReadAndUpdate;
|
|
101
|
+
const CanFullAccess = (scope) => {
|
|
102
|
+
return (0, exports.RequirePermissions)({ action: common_2.PermissionAction.CREATE, scope }, { action: common_2.PermissionAction.READ, scope }, { action: common_2.PermissionAction.UPDATE, scope }, { action: common_2.PermissionAction.DELETE, scope });
|
|
103
|
+
};
|
|
104
|
+
exports.CanFullAccess = CanFullAccess;
|
|
105
|
+
exports.ContactPermissions = {
|
|
106
|
+
CanCreateContact: () => (0, exports.CanCreate)(common_2.PermissionScope.GROUP),
|
|
107
|
+
CanReadContact: () => (0, exports.CanRead)(common_2.PermissionScope.ASSIGNED),
|
|
108
|
+
CanUpdateContact: () => (0, exports.CanUpdate)(common_2.PermissionScope.ASSIGNED),
|
|
109
|
+
CanDeleteContact: () => (0, exports.CanDelete)(common_2.PermissionScope.OWN),
|
|
110
|
+
CanManageContacts: () => (0, exports.CanManage)(common_2.PermissionScope.ALL),
|
|
111
|
+
CanMergeContacts: () => (0, exports.RequirePermissions)({
|
|
112
|
+
action: common_2.PermissionAction.UPDATE,
|
|
113
|
+
scope: common_2.PermissionScope.GROUP,
|
|
114
|
+
conditions: ["SAME_GROUP"],
|
|
115
|
+
}),
|
|
116
|
+
CanExportContacts: () => (0, exports.CanExport)(common_2.PermissionScope.GROUP),
|
|
117
|
+
};
|
|
118
|
+
exports.LeadPermissions = {
|
|
119
|
+
CanCreateLead: () => (0, exports.CanCreate)(common_2.PermissionScope.GROUP),
|
|
120
|
+
CanReadLead: () => (0, exports.CanRead)(common_2.PermissionScope.ASSIGNED),
|
|
121
|
+
CanUpdateLead: () => (0, exports.CanUpdate)(common_2.PermissionScope.ASSIGNED),
|
|
122
|
+
CanDeleteLead: () => (0, exports.CanDelete)(common_2.PermissionScope.OWN),
|
|
123
|
+
CanConvertLead: () => (0, exports.RequirePermissions)({
|
|
124
|
+
action: common_2.PermissionAction.UPDATE,
|
|
125
|
+
scope: common_2.PermissionScope.ASSIGNED,
|
|
126
|
+
conditions: ["ASSIGNED_TO", "OWNER"],
|
|
127
|
+
}),
|
|
128
|
+
CanCancelLead: () => (0, exports.RequirePermissions)({
|
|
129
|
+
action: common_2.PermissionAction.CANCEL,
|
|
130
|
+
scope: common_2.PermissionScope.ASSIGNED,
|
|
131
|
+
}),
|
|
132
|
+
};
|
|
133
|
+
exports.PolicyPermissions = {
|
|
134
|
+
CanCreatePolicy: () => (0, exports.CanCreate)(common_2.PermissionScope.GROUP),
|
|
135
|
+
CanReadPolicy: () => (0, exports.CanRead)(common_2.PermissionScope.ASSIGNED),
|
|
136
|
+
CanUpdatePolicy: () => (0, exports.CanUpdate)(common_2.PermissionScope.ASSIGNED),
|
|
137
|
+
CanDeletePolicy: () => (0, exports.CanDelete)(common_2.PermissionScope.OWN),
|
|
138
|
+
CanCancelPolicy: () => (0, exports.RequirePermissions)({
|
|
139
|
+
action: common_2.PermissionAction.CANCEL,
|
|
140
|
+
scope: common_2.PermissionScope.ASSIGNED,
|
|
141
|
+
}),
|
|
142
|
+
CanApprovePolicy: () => (0, exports.CanApprove)(common_2.PermissionScope.GROUP),
|
|
143
|
+
};
|
|
144
|
+
//# sourceMappingURL=permissions.decorator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"permissions.decorator.js","sourceRoot":"","sources":["../../../../src/modules/authorization/decorators/permissions.decorator.ts"],"names":[],"mappings":";;;AAAA,2CAA8D;AAC9D,6CAAqE;A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QAAA,iBAAiB,GAAG;IAC/B,eAAe,EAAE,GAAG,EAAE,CAAC,IAAA,iBAAS,EAAC,wBAAe,CAAC,KAAK,CAAC;IACvD,aAAa,EAAE,GAAG,EAAE,CAAC,IAAA,eAAO,EAAC,wBAAe,CAAC,QAAQ,CAAC;IACtD,eAAe,EAAE,GAAG,EAAE,CAAC,IAAA,iBAAS,EAAC,wBAAe,CAAC,QAAQ,CAAC;IAC1D,eAAe,EAAE,GAAG,EAAE,CAAC,IAAA,iBAAS,EAAC,wBAAe,CAAC,GAAG,CAAC;IACrD,eAAe,EAAE,GAAG,EAAE,CACpB,IAAA,0BAAkB,EAAC;QACjB,MAAM,EAAE,yBAAgB,CAAC,MAAM;QAC/B,KAAK,EAAE,wBAAe,CAAC,QAAQ;KAChC,CAAC;IACJ,gBAAgB,EAAE,GAAG,EAAE,CAAC,IAAA,kBAAU,EAAC,wBAAe,CAAC,KAAK,CAAC;CAC1D,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Logger } from "@nestjs/common";
|
|
2
|
+
import { Repository } from "typeorm";
|
|
3
|
+
import { PermissionAction } from "../../../common/";
|
|
4
|
+
import { SubGroup } from "../../../entities";
|
|
5
|
+
import { ResourceAuthorizationService, ResourceConfig } from "../services/resource-authorization.service";
|
|
6
|
+
export declare class ResourceAuthorizationBuilder {
|
|
7
|
+
private readonly resourceAuthService;
|
|
8
|
+
private readonly logger;
|
|
9
|
+
private resourceConfig?;
|
|
10
|
+
private subGroupRepository?;
|
|
11
|
+
private customConfig?;
|
|
12
|
+
constructor(resourceAuthService: ResourceAuthorizationService, logger: Logger);
|
|
13
|
+
forResource(resourceName: string): this;
|
|
14
|
+
withCustomConfig(config: ResourceConfig): this;
|
|
15
|
+
overrideConfig(overrides: Partial<ResourceConfig>): this;
|
|
16
|
+
withSubGroupRepository(repository: Repository<SubGroup>): this;
|
|
17
|
+
build(): ConfiguredResourceAuthorization;
|
|
18
|
+
}
|
|
19
|
+
export declare class ConfiguredResourceAuthorization {
|
|
20
|
+
private readonly authService;
|
|
21
|
+
private readonly config;
|
|
22
|
+
private readonly subGroupRepository?;
|
|
23
|
+
constructor(authService: ResourceAuthorizationService, config: ResourceConfig, subGroupRepository?: Repository<SubGroup>);
|
|
24
|
+
applyPermissionFilters(queryBuilder: any, user: any, options?: {
|
|
25
|
+
getAll?: boolean;
|
|
26
|
+
assistantIds?: string[];
|
|
27
|
+
action?: PermissionAction;
|
|
28
|
+
}): Promise<import("typeorm").SelectQueryBuilder<unknown>>;
|
|
29
|
+
canPerformAction(user: any, action: PermissionAction, targetEntity?: any): Promise<import("../../../common/").PermissionResult>;
|
|
30
|
+
validateAccess(user: any, action: PermissionAction, targetEntity: any): Promise<void>;
|
|
31
|
+
getAssistantIds(user: any): Promise<string[]>;
|
|
32
|
+
getSubGroupMembers(user: any): Promise<string[]>;
|
|
33
|
+
canCreate(user: any): Promise<boolean>;
|
|
34
|
+
canRead(user: any, entity?: any): Promise<boolean>;
|
|
35
|
+
canUpdate(user: any, entity: any): Promise<boolean>;
|
|
36
|
+
canDelete(user: any, entity: any): Promise<boolean>;
|
|
37
|
+
canManage(user: any): Promise<boolean>;
|
|
38
|
+
canImport(user: any): Promise<boolean>;
|
|
39
|
+
canExport(user: any): Promise<boolean>;
|
|
40
|
+
getConfig(): ResourceConfig;
|
|
41
|
+
hasSubGroupSupport(): boolean;
|
|
42
|
+
}
|
|
43
|
+
export declare class ResourceAuthorizationFactory {
|
|
44
|
+
private readonly resourceAuthService;
|
|
45
|
+
private readonly logger;
|
|
46
|
+
constructor(resourceAuthService: ResourceAuthorizationService);
|
|
47
|
+
createBuilder(): ResourceAuthorizationBuilder;
|
|
48
|
+
forContact(subGroupRepository: Repository<SubGroup>): ConfiguredResourceAuthorization;
|
|
49
|
+
forLead(subGroupRepository?: Repository<SubGroup>): ConfiguredResourceAuthorization;
|
|
50
|
+
forPolicy(subGroupRepository?: Repository<SubGroup>): ConfiguredResourceAuthorization;
|
|
51
|
+
forTask(subGroupRepository?: Repository<SubGroup>): ConfiguredResourceAuthorization;
|
|
52
|
+
forResource(resourceName: string, subGroupRepository?: Repository<SubGroup>): ConfiguredResourceAuthorization;
|
|
53
|
+
getAvailableResources(): string[];
|
|
54
|
+
isValidResource(resourceName: string): boolean;
|
|
55
|
+
}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var ResourceAuthorizationFactory_1;
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.ResourceAuthorizationFactory = exports.ConfiguredResourceAuthorization = exports.ResourceAuthorizationBuilder = void 0;
|
|
14
|
+
const common_1 = require("@nestjs/common");
|
|
15
|
+
const resource_authorization_service_1 = require("../services/resource-authorization.service");
|
|
16
|
+
const resource_configurations_1 = require("../config/resource-configurations");
|
|
17
|
+
class ResourceAuthorizationBuilder {
|
|
18
|
+
resourceAuthService;
|
|
19
|
+
logger;
|
|
20
|
+
resourceConfig;
|
|
21
|
+
subGroupRepository;
|
|
22
|
+
customConfig;
|
|
23
|
+
constructor(resourceAuthService, logger) {
|
|
24
|
+
this.resourceAuthService = resourceAuthService;
|
|
25
|
+
this.logger = logger;
|
|
26
|
+
}
|
|
27
|
+
forResource(resourceName) {
|
|
28
|
+
try {
|
|
29
|
+
this.resourceConfig = (0, resource_configurations_1.getResourceConfig)(resourceName);
|
|
30
|
+
this.logger.debug(`Configured authorization for resource: ${resourceName}`);
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
this.logger.error(`Failed to configure resource ${resourceName}: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
34
|
+
throw error;
|
|
35
|
+
}
|
|
36
|
+
return this;
|
|
37
|
+
}
|
|
38
|
+
withCustomConfig(config) {
|
|
39
|
+
this.resourceConfig = config;
|
|
40
|
+
this.logger.debug(`Configured authorization with custom config for: ${config.name}`);
|
|
41
|
+
return this;
|
|
42
|
+
}
|
|
43
|
+
overrideConfig(overrides) {
|
|
44
|
+
this.customConfig = overrides;
|
|
45
|
+
this.logger.debug(`Added config overrides: ${JSON.stringify(overrides)}`);
|
|
46
|
+
return this;
|
|
47
|
+
}
|
|
48
|
+
withSubGroupRepository(repository) {
|
|
49
|
+
this.subGroupRepository = repository;
|
|
50
|
+
return this;
|
|
51
|
+
}
|
|
52
|
+
build() {
|
|
53
|
+
if (!this.resourceConfig) {
|
|
54
|
+
throw new Error("Resource configuration is required. Call forResource() or withCustomConfig() first.");
|
|
55
|
+
}
|
|
56
|
+
const finalConfig = this.customConfig
|
|
57
|
+
? { ...this.resourceConfig, ...this.customConfig }
|
|
58
|
+
: this.resourceConfig;
|
|
59
|
+
if (finalConfig.subGroupConfig?.enabled && !this.subGroupRepository) {
|
|
60
|
+
this.logger.warn(`Subgroups are enabled for ${finalConfig.name} but no SubGroup repository provided`);
|
|
61
|
+
}
|
|
62
|
+
return new ConfiguredResourceAuthorization(this.resourceAuthService, finalConfig, this.subGroupRepository);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
exports.ResourceAuthorizationBuilder = ResourceAuthorizationBuilder;
|
|
66
|
+
class ConfiguredResourceAuthorization {
|
|
67
|
+
authService;
|
|
68
|
+
config;
|
|
69
|
+
subGroupRepository;
|
|
70
|
+
constructor(authService, config, subGroupRepository) {
|
|
71
|
+
this.authService = authService;
|
|
72
|
+
this.config = config;
|
|
73
|
+
this.subGroupRepository = subGroupRepository;
|
|
74
|
+
}
|
|
75
|
+
async applyPermissionFilters(queryBuilder, user, options = {}) {
|
|
76
|
+
return this.authService.applyPermissionFilters(queryBuilder, user, this.config, {
|
|
77
|
+
...options,
|
|
78
|
+
subGroupRepository: this.subGroupRepository,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
async canPerformAction(user, action, targetEntity) {
|
|
82
|
+
return this.authService.canPerformAction(user, action, this.config, targetEntity);
|
|
83
|
+
}
|
|
84
|
+
async validateAccess(user, action, targetEntity) {
|
|
85
|
+
return this.authService.validateAccess(user, action, this.config, targetEntity);
|
|
86
|
+
}
|
|
87
|
+
async getAssistantIds(user) {
|
|
88
|
+
if (!this.config.subGroupConfig?.enabled || !this.subGroupRepository) {
|
|
89
|
+
return [];
|
|
90
|
+
}
|
|
91
|
+
return this.authService.getAssistantIds(user, this.subGroupRepository);
|
|
92
|
+
}
|
|
93
|
+
async getSubGroupMembers(user) {
|
|
94
|
+
if (!this.config.subGroupConfig?.enabled || !this.subGroupRepository) {
|
|
95
|
+
return [];
|
|
96
|
+
}
|
|
97
|
+
return this.authService.getSubGroupMembers(user, this.subGroupRepository);
|
|
98
|
+
}
|
|
99
|
+
async canCreate(user) {
|
|
100
|
+
return this.authService.canCreate(user, this.config);
|
|
101
|
+
}
|
|
102
|
+
async canRead(user, entity) {
|
|
103
|
+
return this.authService.canRead(user, this.config, entity);
|
|
104
|
+
}
|
|
105
|
+
async canUpdate(user, entity) {
|
|
106
|
+
return this.authService.canUpdate(user, this.config, entity);
|
|
107
|
+
}
|
|
108
|
+
async canDelete(user, entity) {
|
|
109
|
+
return this.authService.canDelete(user, this.config, entity);
|
|
110
|
+
}
|
|
111
|
+
async canManage(user) {
|
|
112
|
+
return this.authService.canManage(user, this.config);
|
|
113
|
+
}
|
|
114
|
+
async canImport(user) {
|
|
115
|
+
return this.authService.canImport(user, this.config);
|
|
116
|
+
}
|
|
117
|
+
async canExport(user) {
|
|
118
|
+
return this.authService.canExport(user, this.config);
|
|
119
|
+
}
|
|
120
|
+
getConfig() {
|
|
121
|
+
return this.config;
|
|
122
|
+
}
|
|
123
|
+
hasSubGroupSupport() {
|
|
124
|
+
return this.config.subGroupConfig?.enabled ?? false;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
exports.ConfiguredResourceAuthorization = ConfiguredResourceAuthorization;
|
|
128
|
+
let ResourceAuthorizationFactory = ResourceAuthorizationFactory_1 = class ResourceAuthorizationFactory {
|
|
129
|
+
resourceAuthService;
|
|
130
|
+
logger = new common_1.Logger(ResourceAuthorizationFactory_1.name);
|
|
131
|
+
constructor(resourceAuthService) {
|
|
132
|
+
this.resourceAuthService = resourceAuthService;
|
|
133
|
+
}
|
|
134
|
+
createBuilder() {
|
|
135
|
+
return new ResourceAuthorizationBuilder(this.resourceAuthService, this.logger);
|
|
136
|
+
}
|
|
137
|
+
forContact(subGroupRepository) {
|
|
138
|
+
const builder = this.createBuilder().forResource("contact");
|
|
139
|
+
if (subGroupRepository) {
|
|
140
|
+
builder.withSubGroupRepository(subGroupRepository);
|
|
141
|
+
}
|
|
142
|
+
return builder.build();
|
|
143
|
+
}
|
|
144
|
+
forLead(subGroupRepository) {
|
|
145
|
+
const builder = this.createBuilder().forResource("lead");
|
|
146
|
+
if (subGroupRepository) {
|
|
147
|
+
builder.withSubGroupRepository(subGroupRepository);
|
|
148
|
+
}
|
|
149
|
+
return builder.build();
|
|
150
|
+
}
|
|
151
|
+
forPolicy(subGroupRepository) {
|
|
152
|
+
const builder = this.createBuilder().forResource("policy");
|
|
153
|
+
if (subGroupRepository) {
|
|
154
|
+
builder.withSubGroupRepository(subGroupRepository);
|
|
155
|
+
}
|
|
156
|
+
return builder.build();
|
|
157
|
+
}
|
|
158
|
+
forTask(subGroupRepository) {
|
|
159
|
+
const builder = this.createBuilder().forResource("task");
|
|
160
|
+
if (subGroupRepository) {
|
|
161
|
+
builder.withSubGroupRepository(subGroupRepository);
|
|
162
|
+
}
|
|
163
|
+
return builder.build();
|
|
164
|
+
}
|
|
165
|
+
forResource(resourceName, subGroupRepository) {
|
|
166
|
+
const builder = this.createBuilder().forResource(resourceName);
|
|
167
|
+
if (subGroupRepository) {
|
|
168
|
+
builder.withSubGroupRepository(subGroupRepository);
|
|
169
|
+
}
|
|
170
|
+
return builder.build();
|
|
171
|
+
}
|
|
172
|
+
getAvailableResources() {
|
|
173
|
+
return Object.keys(resource_configurations_1.RESOURCE_CONFIGURATIONS);
|
|
174
|
+
}
|
|
175
|
+
isValidResource(resourceName) {
|
|
176
|
+
return resourceName in resource_configurations_1.RESOURCE_CONFIGURATIONS;
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
exports.ResourceAuthorizationFactory = ResourceAuthorizationFactory;
|
|
180
|
+
exports.ResourceAuthorizationFactory = ResourceAuthorizationFactory = ResourceAuthorizationFactory_1 = __decorate([
|
|
181
|
+
(0, common_1.Injectable)(),
|
|
182
|
+
__metadata("design:paramtypes", [resource_authorization_service_1.ResourceAuthorizationService])
|
|
183
|
+
], ResourceAuthorizationFactory);
|
|
184
|
+
//# sourceMappingURL=resource-authorization.factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource-authorization.factory.js","sourceRoot":"","sources":["../../../../src/modules/authorization/factories/resource-authorization.factory.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAoD;AAIpD,+FAGoD;AACpD,+EAG2C;AAM3C,MAAa,4BAA4B;IAMpB;IACA;IANX,cAAc,CAAkB;IAChC,kBAAkB,CAAwB;IAC1C,YAAY,CAA2B;IAE/C,YACmB,mBAAiD,EACjD,MAAc;QADd,wBAAmB,GAAnB,mBAAmB,CAA8B;QACjD,WAAM,GAAN,MAAM,CAAQ;IAC9B,CAAC;IAKJ,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3
|
+
export * from "./services";
|
|
4
|
+
export * from "./factories/resource-authorization.factory";
|
|
5
|
+
export * from "./config/resource-configurations";
|
|
6
|
+
export * from "./decorators/permissions.decorator";
|
|
7
|
+
export * from "./decorators/contact-permissions.decorator";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./authorization.module"), exports);
|
|
18
|
+
__exportStar(require("./interfaces/authorization.interface"), exports);
|
|
19
|
+
__exportStar(require("./services"), exports);
|
|
20
|
+
__exportStar(require("./factories/resource-authorization.factory"), exports);
|
|
21
|
+
__exportStar(require("./config/resource-configurations"), exports);
|
|
22
|
+
__exportStar(require("./decorators/permissions.decorator"), exports);
|
|
23
|
+
__exportStar(require("./decorators/contact-permissions.decorator"), exports);
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/authorization/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AACA,yDAAuC;AAGvC,uEAAqD;AAGrD,6CAA2B;AAG3B,6EAA2D;AAG3D,mEAAiD;AAGjD,qEAAmD;AACnD,6EAA2D"}
|