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.
- package/LICENSE +21 -0
- package/README.md +1397 -0
- package/dist/constants/contractx-permissions.constants.d.ts +310 -0
- package/dist/constants/contractx-permissions.constants.d.ts.map +1 -0
- package/dist/constants/contractx-permissions.constants.js +1061 -0
- package/dist/constants/contractx-roles.constants.d.ts +295 -0
- package/dist/constants/contractx-roles.constants.d.ts.map +1 -0
- package/dist/constants/contractx-roles.constants.js +238 -0
- package/dist/constants/index.d.ts +3 -0
- package/dist/constants/index.d.ts.map +1 -0
- package/dist/constants/index.js +18 -0
- package/dist/constants/security.constants.d.ts +77 -0
- package/dist/constants/security.constants.d.ts.map +1 -0
- package/dist/constants/security.constants.js +139 -0
- package/dist/decorators/current-user.decorator.d.ts +73 -0
- package/dist/decorators/current-user.decorator.d.ts.map +1 -0
- package/dist/decorators/current-user.decorator.js +91 -0
- package/dist/decorators/index.d.ts +5 -0
- package/dist/decorators/index.d.ts.map +1 -0
- package/dist/decorators/index.js +20 -0
- package/dist/decorators/permissions.decorator.d.ts +97 -0
- package/dist/decorators/permissions.decorator.d.ts.map +1 -0
- package/dist/decorators/permissions.decorator.js +106 -0
- package/dist/decorators/public.decorator.d.ts +18 -0
- package/dist/decorators/public.decorator.d.ts.map +1 -0
- package/dist/decorators/public.decorator.js +22 -0
- package/dist/decorators/roles.decorator.d.ts +79 -0
- package/dist/decorators/roles.decorator.d.ts.map +1 -0
- package/dist/decorators/roles.decorator.js +87 -0
- package/dist/guards/index.d.ts +4 -0
- package/dist/guards/index.d.ts.map +1 -0
- package/dist/guards/index.js +19 -0
- package/dist/guards/jwt-auth.guard.d.ts +21 -0
- package/dist/guards/jwt-auth.guard.d.ts.map +1 -0
- package/dist/guards/jwt-auth.guard.js +115 -0
- package/dist/guards/permissions.guard.d.ts +14 -0
- package/dist/guards/permissions.guard.d.ts.map +1 -0
- package/dist/guards/permissions.guard.js +77 -0
- package/dist/guards/roles.guard.d.ts +13 -0
- package/dist/guards/roles.guard.d.ts.map +1 -0
- package/dist/guards/roles.guard.js +59 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +28 -0
- package/dist/interfaces/index.d.ts +2 -0
- package/dist/interfaces/index.d.ts.map +1 -0
- package/dist/interfaces/index.js +17 -0
- package/dist/interfaces/jwt-payload.interface.d.ts +93 -0
- package/dist/interfaces/jwt-payload.interface.d.ts.map +1 -0
- package/dist/interfaces/jwt-payload.interface.js +2 -0
- package/dist/modules/index.d.ts +2 -0
- package/dist/modules/index.d.ts.map +1 -0
- package/dist/modules/index.js +17 -0
- package/dist/modules/permissions-contractx.module.d.ts +41 -0
- package/dist/modules/permissions-contractx.module.d.ts.map +1 -0
- package/dist/modules/permissions-contractx.module.js +215 -0
- package/dist/services/contractx-authorization.service.d.ts +107 -0
- package/dist/services/contractx-authorization.service.d.ts.map +1 -0
- package/dist/services/contractx-authorization.service.js +362 -0
- package/dist/services/contractx-document-compliance.service.d.ts +85 -0
- package/dist/services/contractx-document-compliance.service.d.ts.map +1 -0
- package/dist/services/contractx-document-compliance.service.js +536 -0
- package/dist/services/contractx-validation.service.d.ts +76 -0
- package/dist/services/contractx-validation.service.d.ts.map +1 -0
- package/dist/services/contractx-validation.service.js +305 -0
- package/dist/services/index.d.ts +6 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/index.js +20 -0
- package/dist/services/user-context.service.d.ts +114 -0
- package/dist/services/user-context.service.d.ts.map +1 -0
- package/dist/services/user-context.service.js +199 -0
- package/dist/test-document-compliance.d.ts +7 -0
- package/dist/test-document-compliance.d.ts.map +1 -0
- package/dist/test-document-compliance.js +118 -0
- package/package.json +405 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { DynamicModule } from '@nestjs/common';
|
|
2
|
+
import { PermissionsModuleOptions } from '../interfaces';
|
|
3
|
+
/**
|
|
4
|
+
* ContractX Permissions Module
|
|
5
|
+
* Provides authentication and authorization for NestJS microservices
|
|
6
|
+
*/
|
|
7
|
+
export declare class PermissionsContractXModule {
|
|
8
|
+
/**
|
|
9
|
+
* Register the module with configuration
|
|
10
|
+
*
|
|
11
|
+
* @param options - Module configuration options
|
|
12
|
+
* @returns DynamicModule
|
|
13
|
+
*/
|
|
14
|
+
static register(options: PermissionsModuleOptions): DynamicModule;
|
|
15
|
+
/**
|
|
16
|
+
* Register module asynchronously with factory
|
|
17
|
+
*
|
|
18
|
+
* @param options - Async configuration options
|
|
19
|
+
* @returns DynamicModule
|
|
20
|
+
*/
|
|
21
|
+
static registerAsync(options: {
|
|
22
|
+
imports?: any[];
|
|
23
|
+
useFactory: (...args: any[]) => PermissionsModuleOptions | Promise<PermissionsModuleOptions>;
|
|
24
|
+
inject?: any[];
|
|
25
|
+
}): DynamicModule;
|
|
26
|
+
/**
|
|
27
|
+
* Quick setup for development with environment variables
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* @Module({
|
|
32
|
+
* imports: [
|
|
33
|
+
* PermissionsContractXModule.forRoot()
|
|
34
|
+
* ]
|
|
35
|
+
* })
|
|
36
|
+
* export class AppModule {}
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
static forRoot(): DynamicModule;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=permissions-contractx.module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"permissions-contractx.module.d.ts","sourceRoot":"","sources":["../../src/modules/permissions-contractx.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,aAAa,EAAU,MAAM,gBAAgB,CAAC;AAK/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AASzD;;;GAGG;AACH,qBAKa,0BAA0B;IACrC;;;;;OAKG;IACH,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,wBAAwB,GAAG,aAAa;IAsEjE;;;;;OAKG;IACH,MAAM,CAAC,aAAa,CAAC,OAAO,EAAE;QAC5B,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC;QAChB,UAAU,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,wBAAwB,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC;QAC7F,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC;KAChB,GAAG,aAAa;IAgEjB;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,OAAO,IAAI,aAAa;CA2BhC"}
|
|
@@ -0,0 +1,215 @@
|
|
|
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 PermissionsContractXModule_1;
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.PermissionsContractXModule = void 0;
|
|
11
|
+
const common_1 = require("@nestjs/common");
|
|
12
|
+
const jwt_1 = require("@nestjs/jwt");
|
|
13
|
+
const config_1 = require("@nestjs/config");
|
|
14
|
+
const core_1 = require("@nestjs/core");
|
|
15
|
+
const guards_1 = require("../guards");
|
|
16
|
+
const constants_1 = require("../constants");
|
|
17
|
+
const services_1 = require("../services");
|
|
18
|
+
/**
|
|
19
|
+
* ContractX Permissions Module
|
|
20
|
+
* Provides authentication and authorization for NestJS microservices
|
|
21
|
+
*/
|
|
22
|
+
let PermissionsContractXModule = PermissionsContractXModule_1 = class PermissionsContractXModule {
|
|
23
|
+
/**
|
|
24
|
+
* Register the module with configuration
|
|
25
|
+
*
|
|
26
|
+
* @param options - Module configuration options
|
|
27
|
+
* @returns DynamicModule
|
|
28
|
+
*/
|
|
29
|
+
static register(options) {
|
|
30
|
+
return {
|
|
31
|
+
module: PermissionsContractXModule_1,
|
|
32
|
+
imports: [
|
|
33
|
+
config_1.ConfigModule,
|
|
34
|
+
jwt_1.JwtModule.register({
|
|
35
|
+
secret: options.jwt.secret,
|
|
36
|
+
signOptions: {
|
|
37
|
+
expiresIn: options.jwt.expiresIn || '15m',
|
|
38
|
+
issuer: options.jwt.issuer,
|
|
39
|
+
audience: options.jwt.audience,
|
|
40
|
+
},
|
|
41
|
+
verifyOptions: {
|
|
42
|
+
issuer: options.jwt.issuer,
|
|
43
|
+
audience: options.jwt.audience,
|
|
44
|
+
clockTolerance: options.jwt.clockTolerance || 0,
|
|
45
|
+
ignoreExpiration: options.jwt.ignoreExpiration || false,
|
|
46
|
+
},
|
|
47
|
+
}),
|
|
48
|
+
],
|
|
49
|
+
providers: [
|
|
50
|
+
{
|
|
51
|
+
provide: constants_1.MODULE_CONSTANTS.MODULE_OPTIONS_TOKEN,
|
|
52
|
+
useValue: options,
|
|
53
|
+
},
|
|
54
|
+
services_1.UserContextService,
|
|
55
|
+
services_1.ContractXValidationService,
|
|
56
|
+
services_1.ContractXAuthorizationService,
|
|
57
|
+
guards_1.JwtAuthGuard,
|
|
58
|
+
guards_1.RolesGuard,
|
|
59
|
+
guards_1.PermissionsGuard,
|
|
60
|
+
// Apply global guards if enabled
|
|
61
|
+
...(options.guards?.enableGlobalAuth
|
|
62
|
+
? [
|
|
63
|
+
{
|
|
64
|
+
provide: core_1.APP_GUARD,
|
|
65
|
+
useClass: guards_1.JwtAuthGuard,
|
|
66
|
+
},
|
|
67
|
+
]
|
|
68
|
+
: []),
|
|
69
|
+
...(options.guards?.enableGlobalRoles
|
|
70
|
+
? [
|
|
71
|
+
{
|
|
72
|
+
provide: core_1.APP_GUARD,
|
|
73
|
+
useClass: guards_1.RolesGuard,
|
|
74
|
+
},
|
|
75
|
+
]
|
|
76
|
+
: []),
|
|
77
|
+
...(options.guards?.enableGlobalPermissions
|
|
78
|
+
? [
|
|
79
|
+
{
|
|
80
|
+
provide: core_1.APP_GUARD,
|
|
81
|
+
useClass: guards_1.PermissionsGuard,
|
|
82
|
+
},
|
|
83
|
+
]
|
|
84
|
+
: []),
|
|
85
|
+
],
|
|
86
|
+
exports: [
|
|
87
|
+
jwt_1.JwtModule,
|
|
88
|
+
services_1.UserContextService,
|
|
89
|
+
services_1.ContractXValidationService,
|
|
90
|
+
services_1.ContractXAuthorizationService,
|
|
91
|
+
guards_1.JwtAuthGuard,
|
|
92
|
+
guards_1.RolesGuard,
|
|
93
|
+
guards_1.PermissionsGuard,
|
|
94
|
+
constants_1.MODULE_CONSTANTS.MODULE_OPTIONS_TOKEN,
|
|
95
|
+
],
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Register module asynchronously with factory
|
|
100
|
+
*
|
|
101
|
+
* @param options - Async configuration options
|
|
102
|
+
* @returns DynamicModule
|
|
103
|
+
*/
|
|
104
|
+
static registerAsync(options) {
|
|
105
|
+
return {
|
|
106
|
+
module: PermissionsContractXModule_1,
|
|
107
|
+
imports: [
|
|
108
|
+
config_1.ConfigModule,
|
|
109
|
+
jwt_1.JwtModule.registerAsync({
|
|
110
|
+
imports: options.imports || [],
|
|
111
|
+
useFactory: async (...args) => {
|
|
112
|
+
const moduleOptions = await options.useFactory(...args);
|
|
113
|
+
return {
|
|
114
|
+
secret: moduleOptions.jwt.secret,
|
|
115
|
+
signOptions: {
|
|
116
|
+
expiresIn: moduleOptions.jwt.expiresIn || '15m',
|
|
117
|
+
issuer: moduleOptions.jwt.issuer,
|
|
118
|
+
audience: moduleOptions.jwt.audience,
|
|
119
|
+
},
|
|
120
|
+
verifyOptions: {
|
|
121
|
+
issuer: moduleOptions.jwt.issuer,
|
|
122
|
+
audience: moduleOptions.jwt.audience,
|
|
123
|
+
clockTolerance: moduleOptions.jwt.clockTolerance || 0,
|
|
124
|
+
ignoreExpiration: moduleOptions.jwt.ignoreExpiration || false,
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
},
|
|
128
|
+
inject: options.inject || [],
|
|
129
|
+
}),
|
|
130
|
+
...(options.imports || []),
|
|
131
|
+
],
|
|
132
|
+
providers: [
|
|
133
|
+
{
|
|
134
|
+
provide: constants_1.MODULE_CONSTANTS.MODULE_OPTIONS_TOKEN,
|
|
135
|
+
useFactory: options.useFactory,
|
|
136
|
+
inject: options.inject || [],
|
|
137
|
+
},
|
|
138
|
+
services_1.UserContextService,
|
|
139
|
+
services_1.ContractXValidationService,
|
|
140
|
+
services_1.ContractXAuthorizationService,
|
|
141
|
+
guards_1.JwtAuthGuard,
|
|
142
|
+
guards_1.RolesGuard,
|
|
143
|
+
guards_1.PermissionsGuard,
|
|
144
|
+
// Apply global guards conditionally
|
|
145
|
+
{
|
|
146
|
+
provide: 'GLOBAL_AUTH_GUARD',
|
|
147
|
+
useFactory: (moduleOptions) => moduleOptions.guards?.enableGlobalAuth,
|
|
148
|
+
inject: [constants_1.MODULE_CONSTANTS.MODULE_OPTIONS_TOKEN],
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
provide: core_1.APP_GUARD,
|
|
152
|
+
useClass: guards_1.JwtAuthGuard,
|
|
153
|
+
},
|
|
154
|
+
],
|
|
155
|
+
exports: [
|
|
156
|
+
jwt_1.JwtModule,
|
|
157
|
+
services_1.UserContextService,
|
|
158
|
+
services_1.ContractXValidationService,
|
|
159
|
+
services_1.ContractXAuthorizationService,
|
|
160
|
+
guards_1.JwtAuthGuard,
|
|
161
|
+
guards_1.RolesGuard,
|
|
162
|
+
guards_1.PermissionsGuard,
|
|
163
|
+
constants_1.MODULE_CONSTANTS.MODULE_OPTIONS_TOKEN,
|
|
164
|
+
],
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Quick setup for development with environment variables
|
|
169
|
+
*
|
|
170
|
+
* @example
|
|
171
|
+
* ```typescript
|
|
172
|
+
* @Module({
|
|
173
|
+
* imports: [
|
|
174
|
+
* PermissionsContractXModule.forRoot()
|
|
175
|
+
* ]
|
|
176
|
+
* })
|
|
177
|
+
* export class AppModule {}
|
|
178
|
+
* ```
|
|
179
|
+
*/
|
|
180
|
+
static forRoot() {
|
|
181
|
+
return this.registerAsync({
|
|
182
|
+
imports: [config_1.ConfigModule],
|
|
183
|
+
useFactory: (configService) => ({
|
|
184
|
+
jwt: {
|
|
185
|
+
secret: configService.get('JWT_SECRET') || 'your-secret-key',
|
|
186
|
+
issuer: configService.get('JWT_ISSUER') || 'contractx-api',
|
|
187
|
+
audience: configService.get('JWT_AUDIENCE') || 'contractx-users',
|
|
188
|
+
expiresIn: configService.get('JWT_EXPIRES_IN') || '15m',
|
|
189
|
+
clockTolerance: parseInt(configService.get('JWT_CLOCK_TOLERANCE') || '0'),
|
|
190
|
+
ignoreExpiration: configService.get('NODE_ENV') === 'development',
|
|
191
|
+
},
|
|
192
|
+
guards: {
|
|
193
|
+
enableGlobalAuth: configService.get('ENABLE_GLOBAL_AUTH') === 'true',
|
|
194
|
+
enableGlobalRoles: configService.get('ENABLE_GLOBAL_ROLES') === 'true',
|
|
195
|
+
enableGlobalPermissions: configService.get('ENABLE_GLOBAL_PERMISSIONS') === 'true',
|
|
196
|
+
},
|
|
197
|
+
security: {
|
|
198
|
+
enableLogging: configService.get('ENABLE_AUTH_LOGGING') === 'true',
|
|
199
|
+
},
|
|
200
|
+
development: {
|
|
201
|
+
disableAuth: configService.get('DISABLE_AUTH') === 'true',
|
|
202
|
+
},
|
|
203
|
+
}),
|
|
204
|
+
inject: [config_1.ConfigService],
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
exports.PermissionsContractXModule = PermissionsContractXModule;
|
|
209
|
+
exports.PermissionsContractXModule = PermissionsContractXModule = PermissionsContractXModule_1 = __decorate([
|
|
210
|
+
(0, common_1.Global)(),
|
|
211
|
+
(0, common_1.Module)({
|
|
212
|
+
providers: [core_1.Reflector],
|
|
213
|
+
exports: [core_1.Reflector],
|
|
214
|
+
})
|
|
215
|
+
], PermissionsContractXModule);
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { ContractXValidationService, ValidationResult } from './contractx-validation.service';
|
|
2
|
+
export interface AuthorizationContext {
|
|
3
|
+
userRoles: string[];
|
|
4
|
+
userPermissions: string[];
|
|
5
|
+
organizationId?: string;
|
|
6
|
+
projectId?: string;
|
|
7
|
+
tenantType?: 'client' | 'provider';
|
|
8
|
+
requestedResource?: string;
|
|
9
|
+
requestedAction?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface AuthorizationResult {
|
|
12
|
+
granted: boolean;
|
|
13
|
+
reason: string;
|
|
14
|
+
level: 'role' | 'permission' | 'system' | 'denied';
|
|
15
|
+
metadata?: Record<string, any>;
|
|
16
|
+
}
|
|
17
|
+
export interface AccessMatrix {
|
|
18
|
+
hasSystemAccess: boolean;
|
|
19
|
+
hasClientAccess: boolean;
|
|
20
|
+
hasProviderAccess: boolean;
|
|
21
|
+
hasAdminAccess: boolean;
|
|
22
|
+
accessibleModules: string[];
|
|
23
|
+
highestRoleLevel: number;
|
|
24
|
+
effectivePermissions: string[];
|
|
25
|
+
}
|
|
26
|
+
export declare class ContractXAuthorizationService {
|
|
27
|
+
private readonly validationService;
|
|
28
|
+
constructor(validationService: ContractXValidationService);
|
|
29
|
+
/**
|
|
30
|
+
* Authorize a user for a specific action on a resource
|
|
31
|
+
*/
|
|
32
|
+
authorize(context: AuthorizationContext): AuthorizationResult;
|
|
33
|
+
/**
|
|
34
|
+
* Check if user has system-level access
|
|
35
|
+
*/
|
|
36
|
+
private hasSystemLevelAccess;
|
|
37
|
+
/**
|
|
38
|
+
* Check role-based access for a resource and action
|
|
39
|
+
*/
|
|
40
|
+
private checkRoleBasedAccess;
|
|
41
|
+
/**
|
|
42
|
+
* Check permission-based access for a resource and action
|
|
43
|
+
*/
|
|
44
|
+
private checkPermissionBasedAccess;
|
|
45
|
+
/**
|
|
46
|
+
* Check if user has any access to a module
|
|
47
|
+
*/
|
|
48
|
+
private checkModuleAccess;
|
|
49
|
+
/**
|
|
50
|
+
* Generate an access matrix for the user
|
|
51
|
+
*/
|
|
52
|
+
generateAccessMatrix(context: AuthorizationContext): AccessMatrix;
|
|
53
|
+
/**
|
|
54
|
+
* Check if user can access a specific tenant
|
|
55
|
+
*/
|
|
56
|
+
canAccessTenant(userRoles: string[], tenantType: 'client' | 'provider'): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Get user's accessible tenant types
|
|
59
|
+
*/
|
|
60
|
+
getAccessibleTenants(userRoles: string[]): ('client' | 'provider' | 'system')[];
|
|
61
|
+
/**
|
|
62
|
+
* Filter resources based on user permissions
|
|
63
|
+
*/
|
|
64
|
+
filterAccessibleResources(userPermissions: string[], resources: string[], requiredAction?: string): string[];
|
|
65
|
+
/**
|
|
66
|
+
* Get user's permissions for a specific module
|
|
67
|
+
*/
|
|
68
|
+
getModulePermissions(userPermissions: string[], module: string): string[];
|
|
69
|
+
/**
|
|
70
|
+
* Check if user has administrative access to a resource
|
|
71
|
+
*/
|
|
72
|
+
hasAdministrativeAccess(userRoles: string[], _resource?: string): boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Validate user context for multi-tenant environment
|
|
75
|
+
*/
|
|
76
|
+
validateMultiTenantAccess(context: AuthorizationContext): ValidationResult;
|
|
77
|
+
/**
|
|
78
|
+
* Get permission summary for logging/audit purposes
|
|
79
|
+
*/
|
|
80
|
+
getPermissionSummary(context: AuthorizationContext): Record<string, any>;
|
|
81
|
+
/**
|
|
82
|
+
* Check if authorization is required for a resource
|
|
83
|
+
*/
|
|
84
|
+
isAuthorizationRequired(resource: string, action: string): boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Get minimum required role for a resource/action combination
|
|
87
|
+
*/
|
|
88
|
+
getMinimumRequiredRole(resource: string, action: string): string[];
|
|
89
|
+
/**
|
|
90
|
+
* Check permission for a user (simpler interface for admin service)
|
|
91
|
+
*/
|
|
92
|
+
checkPermission(user: {
|
|
93
|
+
role: string[];
|
|
94
|
+
permissions: string[];
|
|
95
|
+
}, permission: string, context?: {
|
|
96
|
+
tenantId?: string;
|
|
97
|
+
resourceId?: string;
|
|
98
|
+
}): AuthorizationResult;
|
|
99
|
+
/**
|
|
100
|
+
* Generate access matrix for a user object (simpler interface)
|
|
101
|
+
*/
|
|
102
|
+
generateAccessMatrixForUser(user: {
|
|
103
|
+
role: string[];
|
|
104
|
+
permissions: string[];
|
|
105
|
+
}): AccessMatrix;
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=contractx-authorization.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contractx-authorization.service.d.ts","sourceRoot":"","sources":["../../src/services/contractx-authorization.service.ts"],"names":[],"mappings":"AACA,OAAO,EACL,0BAA0B,EAC1B,gBAAgB,EACjB,MAAM,gCAAgC,CAAC;AAgBxC,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC;IACnC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,GAAG,YAAY,GAAG,QAAQ,GAAG,QAAQ,CAAC;IACnD,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,YAAY;IAC3B,eA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