permissions-contractx 1.0.0

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.
Files changed (75) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1397 -0
  3. package/dist/constants/contractx-permissions.constants.d.ts +310 -0
  4. package/dist/constants/contractx-permissions.constants.d.ts.map +1 -0
  5. package/dist/constants/contractx-permissions.constants.js +1061 -0
  6. package/dist/constants/contractx-roles.constants.d.ts +295 -0
  7. package/dist/constants/contractx-roles.constants.d.ts.map +1 -0
  8. package/dist/constants/contractx-roles.constants.js +238 -0
  9. package/dist/constants/index.d.ts +3 -0
  10. package/dist/constants/index.d.ts.map +1 -0
  11. package/dist/constants/index.js +18 -0
  12. package/dist/constants/security.constants.d.ts +77 -0
  13. package/dist/constants/security.constants.d.ts.map +1 -0
  14. package/dist/constants/security.constants.js +139 -0
  15. package/dist/decorators/current-user.decorator.d.ts +73 -0
  16. package/dist/decorators/current-user.decorator.d.ts.map +1 -0
  17. package/dist/decorators/current-user.decorator.js +91 -0
  18. package/dist/decorators/index.d.ts +5 -0
  19. package/dist/decorators/index.d.ts.map +1 -0
  20. package/dist/decorators/index.js +20 -0
  21. package/dist/decorators/permissions.decorator.d.ts +97 -0
  22. package/dist/decorators/permissions.decorator.d.ts.map +1 -0
  23. package/dist/decorators/permissions.decorator.js +106 -0
  24. package/dist/decorators/public.decorator.d.ts +18 -0
  25. package/dist/decorators/public.decorator.d.ts.map +1 -0
  26. package/dist/decorators/public.decorator.js +22 -0
  27. package/dist/decorators/roles.decorator.d.ts +79 -0
  28. package/dist/decorators/roles.decorator.d.ts.map +1 -0
  29. package/dist/decorators/roles.decorator.js +87 -0
  30. package/dist/guards/index.d.ts +4 -0
  31. package/dist/guards/index.d.ts.map +1 -0
  32. package/dist/guards/index.js +19 -0
  33. package/dist/guards/jwt-auth.guard.d.ts +21 -0
  34. package/dist/guards/jwt-auth.guard.d.ts.map +1 -0
  35. package/dist/guards/jwt-auth.guard.js +115 -0
  36. package/dist/guards/permissions.guard.d.ts +14 -0
  37. package/dist/guards/permissions.guard.d.ts.map +1 -0
  38. package/dist/guards/permissions.guard.js +77 -0
  39. package/dist/guards/roles.guard.d.ts +13 -0
  40. package/dist/guards/roles.guard.d.ts.map +1 -0
  41. package/dist/guards/roles.guard.js +59 -0
  42. package/dist/index.d.ts +8 -0
  43. package/dist/index.d.ts.map +1 -0
  44. package/dist/index.js +28 -0
  45. package/dist/interfaces/index.d.ts +2 -0
  46. package/dist/interfaces/index.d.ts.map +1 -0
  47. package/dist/interfaces/index.js +17 -0
  48. package/dist/interfaces/jwt-payload.interface.d.ts +93 -0
  49. package/dist/interfaces/jwt-payload.interface.d.ts.map +1 -0
  50. package/dist/interfaces/jwt-payload.interface.js +2 -0
  51. package/dist/modules/index.d.ts +2 -0
  52. package/dist/modules/index.d.ts.map +1 -0
  53. package/dist/modules/index.js +17 -0
  54. package/dist/modules/permissions-contractx.module.d.ts +41 -0
  55. package/dist/modules/permissions-contractx.module.d.ts.map +1 -0
  56. package/dist/modules/permissions-contractx.module.js +215 -0
  57. package/dist/services/contractx-authorization.service.d.ts +107 -0
  58. package/dist/services/contractx-authorization.service.d.ts.map +1 -0
  59. package/dist/services/contractx-authorization.service.js +362 -0
  60. package/dist/services/contractx-document-compliance.service.d.ts +85 -0
  61. package/dist/services/contractx-document-compliance.service.d.ts.map +1 -0
  62. package/dist/services/contractx-document-compliance.service.js +536 -0
  63. package/dist/services/contractx-validation.service.d.ts +76 -0
  64. package/dist/services/contractx-validation.service.d.ts.map +1 -0
  65. package/dist/services/contractx-validation.service.js +305 -0
  66. package/dist/services/index.d.ts +6 -0
  67. package/dist/services/index.d.ts.map +1 -0
  68. package/dist/services/index.js +20 -0
  69. package/dist/services/user-context.service.d.ts +114 -0
  70. package/dist/services/user-context.service.d.ts.map +1 -0
  71. package/dist/services/user-context.service.js +199 -0
  72. package/dist/test-document-compliance.d.ts +7 -0
  73. package/dist/test-document-compliance.d.ts.map +1 -0
  74. package/dist/test-document-compliance.js +118 -0
  75. package/package.json +405 -0
@@ -0,0 +1,295 @@
1
+ /**
2
+ * ContractX Role Constants
3
+ * Based on the ODS permissions matrix and auth-service-contract structure
4
+ */
5
+ export declare enum ContractXRoleType {
6
+ ADMIN = "admin",
7
+ MANAGER = "manager",
8
+ OPERATOR = "operator",
9
+ VIEWER = "viewer",
10
+ CUSTOM = "custom",
11
+ SYSTEM = "system"
12
+ }
13
+ export declare enum ContractXRoleScope {
14
+ GLOBAL = "global",
15
+ ORGANIZATION = "organization",
16
+ PROJECT = "project",
17
+ DEPARTMENT = "department",
18
+ TEAM = "team"
19
+ }
20
+ export declare const CONTRACTX_ROLES: {
21
+ readonly SUPERADMIN: "superadmin";
22
+ readonly SUPPORT: "support";
23
+ readonly CLIENT_CONTRACT_ADMIN: "client_contract_admin";
24
+ readonly CLIENT_PERFORMANCE_MANAGER: "client_performance_manager";
25
+ readonly CLIENT_FINANCE_MANAGER: "client_finance_manager";
26
+ readonly CLIENT_REPORTS_MANAGER: "client_reports_manager";
27
+ readonly CLIENT_RELATIONSHIP_MANAGER: "client_relationship_manager";
28
+ readonly CLIENT_RISK_MANAGER: "client_risk_manager";
29
+ readonly PROVIDER_CONTRACT_ADMIN: "provider_contract_admin";
30
+ readonly PROVIDER_PERFORMANCE_MANAGER: "provider_performance_manager";
31
+ readonly PROVIDER_FINANCE_MANAGER: "provider_finance_manager";
32
+ readonly PROVIDER_REPORTS_MANAGER: "provider_reports_manager";
33
+ readonly PROVIDER_RELATIONSHIP_MANAGER: "provider_relationship_manager";
34
+ readonly PROVIDER_RISK_MANAGER: "provider_risk_manager";
35
+ };
36
+ export declare const CONTRACTX_ROLE_DEFINITIONS: {
37
+ readonly superadmin: {
38
+ readonly name: "Super Administrator";
39
+ readonly description: "Full system access with all permissions";
40
+ readonly type: ContractXRoleType.ADMIN;
41
+ readonly scope: ContractXRoleScope.GLOBAL;
42
+ readonly level: 10;
43
+ readonly isSystem: true;
44
+ readonly tenant: "system";
45
+ };
46
+ readonly support: {
47
+ readonly name: "Support";
48
+ readonly description: "Technical support with broad system access";
49
+ readonly type: ContractXRoleType.ADMIN;
50
+ readonly scope: ContractXRoleScope.GLOBAL;
51
+ readonly level: 9;
52
+ readonly isSystem: true;
53
+ readonly tenant: "system";
54
+ };
55
+ readonly client_contract_admin: {
56
+ readonly name: "Client Contract Administrator";
57
+ readonly description: "Full contract management for client organization";
58
+ readonly type: ContractXRoleType.MANAGER;
59
+ readonly scope: ContractXRoleScope.ORGANIZATION;
60
+ readonly level: 8;
61
+ readonly isSystem: false;
62
+ readonly tenant: "client";
63
+ };
64
+ readonly client_performance_manager: {
65
+ readonly name: "Client Performance Manager";
66
+ readonly description: "Performance monitoring and SLA management";
67
+ readonly type: ContractXRoleType.OPERATOR;
68
+ readonly scope: ContractXRoleScope.PROJECT;
69
+ readonly level: 6;
70
+ readonly isSystem: false;
71
+ readonly tenant: "client";
72
+ };
73
+ readonly client_finance_manager: {
74
+ readonly name: "Client Finance Manager";
75
+ readonly description: "Financial management and invoice oversight";
76
+ readonly type: ContractXRoleType.OPERATOR;
77
+ readonly scope: ContractXRoleScope.PROJECT;
78
+ readonly level: 6;
79
+ readonly isSystem: false;
80
+ readonly tenant: "client";
81
+ };
82
+ readonly client_reports_manager: {
83
+ readonly name: "Client Reports Manager";
84
+ readonly description: "Reporting and analytics access";
85
+ readonly type: ContractXRoleType.VIEWER;
86
+ readonly scope: ContractXRoleScope.PROJECT;
87
+ readonly level: 4;
88
+ readonly isSystem: false;
89
+ readonly tenant: "client";
90
+ };
91
+ readonly client_relationship_manager: {
92
+ readonly name: "Client Relationship Manager";
93
+ readonly description: "Relationship management and meeting coordination";
94
+ readonly type: ContractXRoleType.OPERATOR;
95
+ readonly scope: ContractXRoleScope.PROJECT;
96
+ readonly level: 5;
97
+ readonly isSystem: false;
98
+ readonly tenant: "client";
99
+ };
100
+ readonly client_risk_manager: {
101
+ readonly name: "Client Risk Manager";
102
+ readonly description: "Risk assessment and escalation management";
103
+ readonly type: ContractXRoleType.OPERATOR;
104
+ readonly scope: ContractXRoleScope.PROJECT;
105
+ readonly level: 5;
106
+ readonly isSystem: false;
107
+ readonly tenant: "client";
108
+ };
109
+ readonly provider_contract_admin: {
110
+ readonly name: "Provider Contract Administrator";
111
+ readonly description: "Contract management from provider perspective";
112
+ readonly type: ContractXRoleType.MANAGER;
113
+ readonly scope: ContractXRoleScope.ORGANIZATION;
114
+ readonly level: 7;
115
+ readonly isSystem: false;
116
+ readonly tenant: "provider";
117
+ };
118
+ readonly provider_performance_manager: {
119
+ readonly name: "Provider Performance Manager";
120
+ readonly description: "Performance delivery and SLA compliance";
121
+ readonly type: ContractXRoleType.OPERATOR;
122
+ readonly scope: ContractXRoleScope.PROJECT;
123
+ readonly level: 6;
124
+ readonly isSystem: false;
125
+ readonly tenant: "provider";
126
+ };
127
+ readonly provider_finance_manager: {
128
+ readonly name: "Provider Finance Manager";
129
+ readonly description: "Financial management from provider side";
130
+ readonly type: ContractXRoleType.OPERATOR;
131
+ readonly scope: ContractXRoleScope.PROJECT;
132
+ readonly level: 5;
133
+ readonly isSystem: false;
134
+ readonly tenant: "provider";
135
+ };
136
+ readonly provider_reports_manager: {
137
+ readonly name: "Provider Reports Manager";
138
+ readonly description: "Provider reporting capabilities";
139
+ readonly type: ContractXRoleType.VIEWER;
140
+ readonly scope: ContractXRoleScope.PROJECT;
141
+ readonly level: 4;
142
+ readonly isSystem: false;
143
+ readonly tenant: "provider";
144
+ };
145
+ readonly provider_relationship_manager: {
146
+ readonly name: "Provider Relationship Manager";
147
+ readonly description: "Client relationship management from provider side";
148
+ readonly type: ContractXRoleType.OPERATOR;
149
+ readonly scope: ContractXRoleScope.PROJECT;
150
+ readonly level: 5;
151
+ readonly isSystem: false;
152
+ readonly tenant: "provider";
153
+ };
154
+ readonly provider_risk_manager: {
155
+ readonly name: "Provider Risk Manager";
156
+ readonly description: "Risk management from provider perspective";
157
+ readonly type: ContractXRoleType.OPERATOR;
158
+ readonly scope: ContractXRoleScope.PROJECT;
159
+ readonly level: 5;
160
+ readonly isSystem: false;
161
+ readonly tenant: "provider";
162
+ };
163
+ };
164
+ export declare const VALID_CONTRACTX_ROLES: ("superadmin" | "client_contract_admin" | "provider_contract_admin" | "client_performance_manager" | "client_finance_manager" | "client_reports_manager" | "client_relationship_manager" | "client_risk_manager" | "provider_performance_manager" | "provider_finance_manager" | "provider_reports_manager" | "provider_relationship_manager" | "provider_risk_manager" | "support")[];
165
+ export declare const CONTRACTX_ROLE_GROUPS: {
166
+ readonly SYSTEM_ROLES: readonly ["superadmin", "support"];
167
+ readonly CLIENT_ROLES: readonly ["client_contract_admin", "client_performance_manager", "client_finance_manager", "client_reports_manager", "client_relationship_manager", "client_risk_manager"];
168
+ readonly PROVIDER_ROLES: readonly ["provider_contract_admin", "provider_performance_manager", "provider_finance_manager", "provider_reports_manager", "provider_relationship_manager", "provider_risk_manager"];
169
+ readonly ADMIN_ROLES: readonly ["superadmin", "support", "client_contract_admin", "provider_contract_admin"];
170
+ readonly MANAGER_ROLES: readonly ["client_contract_admin", "provider_contract_admin", "client_performance_manager", "provider_performance_manager", "client_finance_manager", "provider_finance_manager"];
171
+ };
172
+ export declare const isSystemRole: (role: string) => boolean;
173
+ export declare const isClientRole: (role: string) => boolean;
174
+ export declare const isProviderRole: (role: string) => boolean;
175
+ export declare const isAdminRole: (role: string) => boolean;
176
+ export declare const getRoleMetadata: (role: string) => {
177
+ readonly name: "Super Administrator";
178
+ readonly description: "Full system access with all permissions";
179
+ readonly type: ContractXRoleType.ADMIN;
180
+ readonly scope: ContractXRoleScope.GLOBAL;
181
+ readonly level: 10;
182
+ readonly isSystem: true;
183
+ readonly tenant: "system";
184
+ } | {
185
+ readonly name: "Support";
186
+ readonly description: "Technical support with broad system access";
187
+ readonly type: ContractXRoleType.ADMIN;
188
+ readonly scope: ContractXRoleScope.GLOBAL;
189
+ readonly level: 9;
190
+ readonly isSystem: true;
191
+ readonly tenant: "system";
192
+ } | {
193
+ readonly name: "Client Contract Administrator";
194
+ readonly description: "Full contract management for client organization";
195
+ readonly type: ContractXRoleType.MANAGER;
196
+ readonly scope: ContractXRoleScope.ORGANIZATION;
197
+ readonly level: 8;
198
+ readonly isSystem: false;
199
+ readonly tenant: "client";
200
+ } | {
201
+ readonly name: "Client Performance Manager";
202
+ readonly description: "Performance monitoring and SLA management";
203
+ readonly type: ContractXRoleType.OPERATOR;
204
+ readonly scope: ContractXRoleScope.PROJECT;
205
+ readonly level: 6;
206
+ readonly isSystem: false;
207
+ readonly tenant: "client";
208
+ } | {
209
+ readonly name: "Client Finance Manager";
210
+ readonly description: "Financial management and invoice oversight";
211
+ readonly type: ContractXRoleType.OPERATOR;
212
+ readonly scope: ContractXRoleScope.PROJECT;
213
+ readonly level: 6;
214
+ readonly isSystem: false;
215
+ readonly tenant: "client";
216
+ } | {
217
+ readonly name: "Client Reports Manager";
218
+ readonly description: "Reporting and analytics access";
219
+ readonly type: ContractXRoleType.VIEWER;
220
+ readonly scope: ContractXRoleScope.PROJECT;
221
+ readonly level: 4;
222
+ readonly isSystem: false;
223
+ readonly tenant: "client";
224
+ } | {
225
+ readonly name: "Client Relationship Manager";
226
+ readonly description: "Relationship management and meeting coordination";
227
+ readonly type: ContractXRoleType.OPERATOR;
228
+ readonly scope: ContractXRoleScope.PROJECT;
229
+ readonly level: 5;
230
+ readonly isSystem: false;
231
+ readonly tenant: "client";
232
+ } | {
233
+ readonly name: "Client Risk Manager";
234
+ readonly description: "Risk assessment and escalation management";
235
+ readonly type: ContractXRoleType.OPERATOR;
236
+ readonly scope: ContractXRoleScope.PROJECT;
237
+ readonly level: 5;
238
+ readonly isSystem: false;
239
+ readonly tenant: "client";
240
+ } | {
241
+ readonly name: "Provider Contract Administrator";
242
+ readonly description: "Contract management from provider perspective";
243
+ readonly type: ContractXRoleType.MANAGER;
244
+ readonly scope: ContractXRoleScope.ORGANIZATION;
245
+ readonly level: 7;
246
+ readonly isSystem: false;
247
+ readonly tenant: "provider";
248
+ } | {
249
+ readonly name: "Provider Performance Manager";
250
+ readonly description: "Performance delivery and SLA compliance";
251
+ readonly type: ContractXRoleType.OPERATOR;
252
+ readonly scope: ContractXRoleScope.PROJECT;
253
+ readonly level: 6;
254
+ readonly isSystem: false;
255
+ readonly tenant: "provider";
256
+ } | {
257
+ readonly name: "Provider Finance Manager";
258
+ readonly description: "Financial management from provider side";
259
+ readonly type: ContractXRoleType.OPERATOR;
260
+ readonly scope: ContractXRoleScope.PROJECT;
261
+ readonly level: 5;
262
+ readonly isSystem: false;
263
+ readonly tenant: "provider";
264
+ } | {
265
+ readonly name: "Provider Reports Manager";
266
+ readonly description: "Provider reporting capabilities";
267
+ readonly type: ContractXRoleType.VIEWER;
268
+ readonly scope: ContractXRoleScope.PROJECT;
269
+ readonly level: 4;
270
+ readonly isSystem: false;
271
+ readonly tenant: "provider";
272
+ } | {
273
+ readonly name: "Provider Relationship Manager";
274
+ readonly description: "Client relationship management from provider side";
275
+ readonly type: ContractXRoleType.OPERATOR;
276
+ readonly scope: ContractXRoleScope.PROJECT;
277
+ readonly level: 5;
278
+ readonly isSystem: false;
279
+ readonly tenant: "provider";
280
+ } | {
281
+ readonly name: "Provider Risk Manager";
282
+ readonly description: "Risk management from provider perspective";
283
+ readonly type: ContractXRoleType.OPERATOR;
284
+ readonly scope: ContractXRoleScope.PROJECT;
285
+ readonly level: 5;
286
+ readonly isSystem: false;
287
+ readonly tenant: "provider";
288
+ };
289
+ export declare const validateRole: (role: string) => boolean;
290
+ export type ContractXRole = typeof CONTRACTX_ROLES[keyof typeof CONTRACTX_ROLES];
291
+ export type ContractXSystemRole = typeof CONTRACTX_ROLE_GROUPS.SYSTEM_ROLES[number];
292
+ export type ContractXClientRole = typeof CONTRACTX_ROLE_GROUPS.CLIENT_ROLES[number];
293
+ export type ContractXProviderRole = typeof CONTRACTX_ROLE_GROUPS.PROVIDER_ROLES[number];
294
+ export type ContractXAdminRole = typeof CONTRACTX_ROLE_GROUPS.ADMIN_ROLES[number];
295
+ //# sourceMappingURL=contractx-roles.constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contractx-roles.constants.d.ts","sourceRoot":"","sources":["../../src/constants/contractx-roles.constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,oBAAY,iBAAiB;IAC3B,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,MAAM,WAAW;CAClB;AAGD,oBAAY,kBAAkB;IAC5B,MAAM,WAAW;IACjB,YAAY,iBAAiB;IAC7B,OAAO,YAAY;IACnB,UAAU,eAAe;IACzB,IAAI,SAAS;CACd;AAGD,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;CAoBlB,CAAC;AAGX,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8I7B,CAAC;AAGX,eAAO,MAAM,qBAAqB,wXAAiC,CAAC;AAGpE,eAAO,MAAM,qBAAqB;;;;;;CAgCxB,CAAC;AAGX,eAAO,MAAM,YAAY,GAAI,MAAM,MAAM,KAAG,OAE3C,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,MAAM,MAAM,KAAG,OAE3C,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,KAAG,OAE7C,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,MAAM,MAAM,KAAG,OAE1C,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAE3C,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,MAAM,MAAM,KAAG,OAE3C,CAAC;AAGF,MAAM,MAAM,aAAa,GAAG,OAAO,eAAe,CAAC,MAAM,OAAO,eAAe,CAAC,CAAC;AACjF,MAAM,MAAM,mBAAmB,GAAG,OAAO,qBAAqB,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;AACpF,MAAM,MAAM,mBAAmB,GAAG,OAAO,qBAAqB,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;AACpF,MAAM,MAAM,qBAAqB,GAAG,OAAO,qBAAqB,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;AACxF,MAAM,MAAM,kBAAkB,GAAG,OAAO,qBAAqB,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC"}
@@ -0,0 +1,238 @@
1
+ "use strict";
2
+ /**
3
+ * ContractX Role Constants
4
+ * Based on the ODS permissions matrix and auth-service-contract structure
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.validateRole = exports.getRoleMetadata = exports.isAdminRole = exports.isProviderRole = exports.isClientRole = exports.isSystemRole = exports.CONTRACTX_ROLE_GROUPS = exports.VALID_CONTRACTX_ROLES = exports.CONTRACTX_ROLE_DEFINITIONS = exports.CONTRACTX_ROLES = exports.ContractXRoleScope = exports.ContractXRoleType = void 0;
8
+ // Role Types from auth-service
9
+ var ContractXRoleType;
10
+ (function (ContractXRoleType) {
11
+ ContractXRoleType["ADMIN"] = "admin";
12
+ ContractXRoleType["MANAGER"] = "manager";
13
+ ContractXRoleType["OPERATOR"] = "operator";
14
+ ContractXRoleType["VIEWER"] = "viewer";
15
+ ContractXRoleType["CUSTOM"] = "custom";
16
+ ContractXRoleType["SYSTEM"] = "system";
17
+ })(ContractXRoleType || (exports.ContractXRoleType = ContractXRoleType = {}));
18
+ // Role Scopes
19
+ var ContractXRoleScope;
20
+ (function (ContractXRoleScope) {
21
+ ContractXRoleScope["GLOBAL"] = "global";
22
+ ContractXRoleScope["ORGANIZATION"] = "organization";
23
+ ContractXRoleScope["PROJECT"] = "project";
24
+ ContractXRoleScope["DEPARTMENT"] = "department";
25
+ ContractXRoleScope["TEAM"] = "team";
26
+ })(ContractXRoleScope || (exports.ContractXRoleScope = ContractXRoleScope = {}));
27
+ // Standard ContractX Roles (based on ODS matrix)
28
+ exports.CONTRACTX_ROLES = {
29
+ // System Roles
30
+ SUPERADMIN: 'superadmin',
31
+ SUPPORT: 'support',
32
+ // Client-Side Roles
33
+ CLIENT_CONTRACT_ADMIN: 'client_contract_admin',
34
+ CLIENT_PERFORMANCE_MANAGER: 'client_performance_manager',
35
+ CLIENT_FINANCE_MANAGER: 'client_finance_manager',
36
+ CLIENT_REPORTS_MANAGER: 'client_reports_manager',
37
+ CLIENT_RELATIONSHIP_MANAGER: 'client_relationship_manager',
38
+ CLIENT_RISK_MANAGER: 'client_risk_manager',
39
+ // Provider-Side Roles
40
+ PROVIDER_CONTRACT_ADMIN: 'provider_contract_admin',
41
+ PROVIDER_PERFORMANCE_MANAGER: 'provider_performance_manager',
42
+ PROVIDER_FINANCE_MANAGER: 'provider_finance_manager',
43
+ PROVIDER_REPORTS_MANAGER: 'provider_reports_manager',
44
+ PROVIDER_RELATIONSHIP_MANAGER: 'provider_relationship_manager',
45
+ PROVIDER_RISK_MANAGER: 'provider_risk_manager',
46
+ };
47
+ // Role Definitions with metadata
48
+ exports.CONTRACTX_ROLE_DEFINITIONS = {
49
+ [exports.CONTRACTX_ROLES.SUPERADMIN]: {
50
+ name: 'Super Administrator',
51
+ description: 'Full system access with all permissions',
52
+ type: ContractXRoleType.ADMIN,
53
+ scope: ContractXRoleScope.GLOBAL,
54
+ level: 10,
55
+ isSystem: true,
56
+ tenant: 'system'
57
+ },
58
+ [exports.CONTRACTX_ROLES.SUPPORT]: {
59
+ name: 'Support',
60
+ description: 'Technical support with broad system access',
61
+ type: ContractXRoleType.ADMIN,
62
+ scope: ContractXRoleScope.GLOBAL,
63
+ level: 9,
64
+ isSystem: true,
65
+ tenant: 'system'
66
+ },
67
+ // Client Roles
68
+ [exports.CONTRACTX_ROLES.CLIENT_CONTRACT_ADMIN]: {
69
+ name: 'Client Contract Administrator',
70
+ description: 'Full contract management for client organization',
71
+ type: ContractXRoleType.MANAGER,
72
+ scope: ContractXRoleScope.ORGANIZATION,
73
+ level: 8,
74
+ isSystem: false,
75
+ tenant: 'client'
76
+ },
77
+ [exports.CONTRACTX_ROLES.CLIENT_PERFORMANCE_MANAGER]: {
78
+ name: 'Client Performance Manager',
79
+ description: 'Performance monitoring and SLA management',
80
+ type: ContractXRoleType.OPERATOR,
81
+ scope: ContractXRoleScope.PROJECT,
82
+ level: 6,
83
+ isSystem: false,
84
+ tenant: 'client'
85
+ },
86
+ [exports.CONTRACTX_ROLES.CLIENT_FINANCE_MANAGER]: {
87
+ name: 'Client Finance Manager',
88
+ description: 'Financial management and invoice oversight',
89
+ type: ContractXRoleType.OPERATOR,
90
+ scope: ContractXRoleScope.PROJECT,
91
+ level: 6,
92
+ isSystem: false,
93
+ tenant: 'client'
94
+ },
95
+ [exports.CONTRACTX_ROLES.CLIENT_REPORTS_MANAGER]: {
96
+ name: 'Client Reports Manager',
97
+ description: 'Reporting and analytics access',
98
+ type: ContractXRoleType.VIEWER,
99
+ scope: ContractXRoleScope.PROJECT,
100
+ level: 4,
101
+ isSystem: false,
102
+ tenant: 'client'
103
+ },
104
+ [exports.CONTRACTX_ROLES.CLIENT_RELATIONSHIP_MANAGER]: {
105
+ name: 'Client Relationship Manager',
106
+ description: 'Relationship management and meeting coordination',
107
+ type: ContractXRoleType.OPERATOR,
108
+ scope: ContractXRoleScope.PROJECT,
109
+ level: 5,
110
+ isSystem: false,
111
+ tenant: 'client'
112
+ },
113
+ [exports.CONTRACTX_ROLES.CLIENT_RISK_MANAGER]: {
114
+ name: 'Client Risk Manager',
115
+ description: 'Risk assessment and escalation management',
116
+ type: ContractXRoleType.OPERATOR,
117
+ scope: ContractXRoleScope.PROJECT,
118
+ level: 5,
119
+ isSystem: false,
120
+ tenant: 'client'
121
+ },
122
+ // Provider Roles
123
+ [exports.CONTRACTX_ROLES.PROVIDER_CONTRACT_ADMIN]: {
124
+ name: 'Provider Contract Administrator',
125
+ description: 'Contract management from provider perspective',
126
+ type: ContractXRoleType.MANAGER,
127
+ scope: ContractXRoleScope.ORGANIZATION,
128
+ level: 7,
129
+ isSystem: false,
130
+ tenant: 'provider'
131
+ },
132
+ [exports.CONTRACTX_ROLES.PROVIDER_PERFORMANCE_MANAGER]: {
133
+ name: 'Provider Performance Manager',
134
+ description: 'Performance delivery and SLA compliance',
135
+ type: ContractXRoleType.OPERATOR,
136
+ scope: ContractXRoleScope.PROJECT,
137
+ level: 6,
138
+ isSystem: false,
139
+ tenant: 'provider'
140
+ },
141
+ [exports.CONTRACTX_ROLES.PROVIDER_FINANCE_MANAGER]: {
142
+ name: 'Provider Finance Manager',
143
+ description: 'Financial management from provider side',
144
+ type: ContractXRoleType.OPERATOR,
145
+ scope: ContractXRoleScope.PROJECT,
146
+ level: 5,
147
+ isSystem: false,
148
+ tenant: 'provider'
149
+ },
150
+ [exports.CONTRACTX_ROLES.PROVIDER_REPORTS_MANAGER]: {
151
+ name: 'Provider Reports Manager',
152
+ description: 'Provider reporting capabilities',
153
+ type: ContractXRoleType.VIEWER,
154
+ scope: ContractXRoleScope.PROJECT,
155
+ level: 4,
156
+ isSystem: false,
157
+ tenant: 'provider'
158
+ },
159
+ [exports.CONTRACTX_ROLES.PROVIDER_RELATIONSHIP_MANAGER]: {
160
+ name: 'Provider Relationship Manager',
161
+ description: 'Client relationship management from provider side',
162
+ type: ContractXRoleType.OPERATOR,
163
+ scope: ContractXRoleScope.PROJECT,
164
+ level: 5,
165
+ isSystem: false,
166
+ tenant: 'provider'
167
+ },
168
+ [exports.CONTRACTX_ROLES.PROVIDER_RISK_MANAGER]: {
169
+ name: 'Provider Risk Manager',
170
+ description: 'Risk management from provider perspective',
171
+ type: ContractXRoleType.OPERATOR,
172
+ scope: ContractXRoleScope.PROJECT,
173
+ level: 5,
174
+ isSystem: false,
175
+ tenant: 'provider'
176
+ },
177
+ };
178
+ // Valid role arrays for validation
179
+ exports.VALID_CONTRACTX_ROLES = Object.values(exports.CONTRACTX_ROLES);
180
+ // Role groups for easier management
181
+ exports.CONTRACTX_ROLE_GROUPS = {
182
+ SYSTEM_ROLES: [exports.CONTRACTX_ROLES.SUPERADMIN, exports.CONTRACTX_ROLES.SUPPORT],
183
+ CLIENT_ROLES: [
184
+ exports.CONTRACTX_ROLES.CLIENT_CONTRACT_ADMIN,
185
+ exports.CONTRACTX_ROLES.CLIENT_PERFORMANCE_MANAGER,
186
+ exports.CONTRACTX_ROLES.CLIENT_FINANCE_MANAGER,
187
+ exports.CONTRACTX_ROLES.CLIENT_REPORTS_MANAGER,
188
+ exports.CONTRACTX_ROLES.CLIENT_RELATIONSHIP_MANAGER,
189
+ exports.CONTRACTX_ROLES.CLIENT_RISK_MANAGER,
190
+ ],
191
+ PROVIDER_ROLES: [
192
+ exports.CONTRACTX_ROLES.PROVIDER_CONTRACT_ADMIN,
193
+ exports.CONTRACTX_ROLES.PROVIDER_PERFORMANCE_MANAGER,
194
+ exports.CONTRACTX_ROLES.PROVIDER_FINANCE_MANAGER,
195
+ exports.CONTRACTX_ROLES.PROVIDER_REPORTS_MANAGER,
196
+ exports.CONTRACTX_ROLES.PROVIDER_RELATIONSHIP_MANAGER,
197
+ exports.CONTRACTX_ROLES.PROVIDER_RISK_MANAGER,
198
+ ],
199
+ ADMIN_ROLES: [
200
+ exports.CONTRACTX_ROLES.SUPERADMIN,
201
+ exports.CONTRACTX_ROLES.SUPPORT,
202
+ exports.CONTRACTX_ROLES.CLIENT_CONTRACT_ADMIN,
203
+ exports.CONTRACTX_ROLES.PROVIDER_CONTRACT_ADMIN,
204
+ ],
205
+ MANAGER_ROLES: [
206
+ exports.CONTRACTX_ROLES.CLIENT_CONTRACT_ADMIN,
207
+ exports.CONTRACTX_ROLES.PROVIDER_CONTRACT_ADMIN,
208
+ exports.CONTRACTX_ROLES.CLIENT_PERFORMANCE_MANAGER,
209
+ exports.CONTRACTX_ROLES.PROVIDER_PERFORMANCE_MANAGER,
210
+ exports.CONTRACTX_ROLES.CLIENT_FINANCE_MANAGER,
211
+ exports.CONTRACTX_ROLES.PROVIDER_FINANCE_MANAGER,
212
+ ],
213
+ };
214
+ // Helper functions
215
+ const isSystemRole = (role) => {
216
+ return exports.CONTRACTX_ROLE_GROUPS.SYSTEM_ROLES.includes(role);
217
+ };
218
+ exports.isSystemRole = isSystemRole;
219
+ const isClientRole = (role) => {
220
+ return exports.CONTRACTX_ROLE_GROUPS.CLIENT_ROLES.includes(role);
221
+ };
222
+ exports.isClientRole = isClientRole;
223
+ const isProviderRole = (role) => {
224
+ return exports.CONTRACTX_ROLE_GROUPS.PROVIDER_ROLES.includes(role);
225
+ };
226
+ exports.isProviderRole = isProviderRole;
227
+ const isAdminRole = (role) => {
228
+ return exports.CONTRACTX_ROLE_GROUPS.ADMIN_ROLES.includes(role);
229
+ };
230
+ exports.isAdminRole = isAdminRole;
231
+ const getRoleMetadata = (role) => {
232
+ return exports.CONTRACTX_ROLE_DEFINITIONS[role];
233
+ };
234
+ exports.getRoleMetadata = getRoleMetadata;
235
+ const validateRole = (role) => {
236
+ return exports.VALID_CONTRACTX_ROLES.includes(role);
237
+ };
238
+ exports.validateRole = validateRole;
@@ -0,0 +1,3 @@
1
+ export * from './security.constants';
2
+ export * from './contractx-permissions.constants';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,mCAAmC,CAAC"}
@@ -0,0 +1,18 @@
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("./security.constants"), exports);
18
+ __exportStar(require("./contractx-permissions.constants"), exports);
@@ -0,0 +1,77 @@
1
+ /**
2
+ * ODS Roles - Exact 16 roles from Excel specification
3
+ * Implements complete role hierarchy for client/provider contract management
4
+ */
5
+ export declare const CONTRACTX_ROLES: {
6
+ readonly SUPERADMIN: "superadmin";
7
+ readonly CLIENT_CONTRACT_ADMIN: "client_contract_admin";
8
+ readonly CLIENT_PERFORMANCE_RESP: "client_performance_resp";
9
+ readonly CLIENT_FINANCE_RESP: "client_finance_resp";
10
+ readonly CLIENT_REPORTS_RESP: "client_reports_resp";
11
+ readonly CLIENT_RELATIONSHIP_RESP: "client_relationship_resp";
12
+ readonly CLIENT_RISK_RESP: "client_risk_resp";
13
+ readonly PROVIDER_CONTRACT_ADMIN: "provider_contract_admin";
14
+ readonly PROVIDER_PERFORMANCE_RESP: "provider_performance_resp";
15
+ readonly PROVIDER_FINANCE_RESP: "provider_finance_resp";
16
+ readonly PROVIDER_REPORTS_RESP: "provider_reports_resp";
17
+ readonly PROVIDER_RELATIONSHIP_RESP: "provider_relationship_resp";
18
+ readonly PROVIDER_RISK_RESP: "provider_risk_resp";
19
+ readonly SUPPORT: "support";
20
+ };
21
+ /**
22
+ * ODS Role Hierarchy Levels - Exact hierarchy from Excel specification
23
+ * Higher numbers indicate higher privileges
24
+ */
25
+ export declare const ROLE_HIERARCHY: {
26
+ readonly superadmin: 100;
27
+ readonly support: 85;
28
+ readonly client_contract_admin: 80;
29
+ readonly client_performance_resp: 70;
30
+ readonly client_finance_resp: 70;
31
+ readonly client_reports_resp: 65;
32
+ readonly client_relationship_resp: 65;
33
+ readonly client_risk_resp: 65;
34
+ readonly provider_contract_admin: 80;
35
+ readonly provider_performance_resp: 70;
36
+ readonly provider_finance_resp: 70;
37
+ readonly provider_reports_resp: 65;
38
+ readonly provider_relationship_resp: 65;
39
+ readonly provider_risk_resp: 65;
40
+ };
41
+ /**
42
+ * Permission Categories for organization
43
+ */
44
+ export declare const PERMISSION_CATEGORIES: {
45
+ readonly USER_MANAGEMENT: "User Management";
46
+ readonly ROLE_MANAGEMENT: "Role Management";
47
+ readonly PERMISSION_MANAGEMENT: "Permission Management";
48
+ readonly CLIENT_MANAGEMENT: "Client Management";
49
+ readonly PROVIDER_MANAGEMENT: "Provider Management";
50
+ readonly CONTRACT_MANAGEMENT: "Contract Management";
51
+ readonly DOCUMENT_MANAGEMENT: "Document Management";
52
+ readonly DELIVERABLE_MANAGEMENT: "Deliverable Management";
53
+ readonly PERFORMANCE_MANAGEMENT: "Performance Management";
54
+ readonly FINANCIAL_MANAGEMENT: "Financial Management";
55
+ readonly COMMUNICATION_MANAGEMENT: "Communication Management";
56
+ readonly SYSTEM_ADMINISTRATION: "System Administration";
57
+ };
58
+ /**
59
+ * ODS Role Groups for easy assignment and management
60
+ */
61
+ export declare const ROLE_GROUPS: {
62
+ readonly ADMIN_ROLES: readonly ["superadmin", "client_contract_admin", "provider_contract_admin"];
63
+ readonly CLIENT_ROLES: readonly ["client_contract_admin", "client_performance_resp", "client_finance_resp", "client_reports_resp", "client_relationship_resp", "client_risk_resp"];
64
+ readonly PROVIDER_ROLES: readonly ["provider_contract_admin", "provider_performance_resp", "provider_finance_resp", "provider_reports_resp", "provider_relationship_resp", "provider_risk_resp"];
65
+ readonly MANAGER_ROLES: readonly ["client_contract_admin", "provider_contract_admin", "client_performance_resp", "provider_performance_resp", "client_finance_resp", "provider_finance_resp"];
66
+ readonly VIEWER_ROLES: readonly ["client_reports_resp", "provider_reports_resp"];
67
+ readonly RESPONSIBILITY_ROLES: readonly ["client_performance_resp", "client_finance_resp", "client_reports_resp", "client_relationship_resp", "client_risk_resp", "provider_performance_resp", "provider_finance_resp", "provider_reports_resp", "provider_relationship_resp", "provider_risk_resp"];
68
+ readonly SYSTEM_ROLES: readonly ["superadmin", "support"];
69
+ };
70
+ /**
71
+ * Module constants for metadata
72
+ */
73
+ export declare const MODULE_CONSTANTS: {
74
+ readonly MODULE_OPTIONS_TOKEN: "PERMISSIONS_CONTRACTX_MODULE_OPTIONS";
75
+ readonly JWT_CONFIG_TOKEN: "PERMISSIONS_CONTRACTX_JWT_CONFIG";
76
+ };
77
+ //# sourceMappingURL=security.constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"security.constants.d.ts","sourceRoot":"","sources":["../../src/constants/security.constants.ts"],"names":[],"mappings":"AAaA;;;GAGG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;CAsBlB,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;CAmBjB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;CAaxB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,WAAW;;;;;;;;CAwDd,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;CAGnB,CAAC"}