grm-shared-library 1.1.56 → 1.1.58
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/cjs/modules/common/services/access-validation.service.js +12 -59
- package/dist/cjs/modules/common/services/access-validation.service.js.map +1 -1
- package/dist/esm/modules/common/services/access-validation.service.js +12 -59
- package/dist/esm/modules/common/services/access-validation.service.js.map +1 -1
- package/dist/types/interfaces/server-message.d.ts +1 -0
- package/dist/types/modules/common/services/access-validation.service.d.ts +1 -21
- package/package.json +1 -1
|
@@ -31,13 +31,22 @@ class AccessValidationService {
|
|
|
31
31
|
if (accessScope.isSuperAdmin) {
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
34
|
-
if (
|
|
34
|
+
if (!entity.organizationId && !entity.controlCentreId) {
|
|
35
|
+
throw new common_1.ForbiddenException(`Access denied: ${entityName} has no access control information`);
|
|
36
|
+
}
|
|
37
|
+
if (accessScope.organizationFilter) {
|
|
38
|
+
if (entity.organizationId !== accessScope.organizationFilter) {
|
|
39
|
+
throw new common_1.ForbiddenException(`Access denied: ${entityName} does not belong to your organization`);
|
|
40
|
+
}
|
|
35
41
|
return;
|
|
36
42
|
}
|
|
37
|
-
if (accessScope.controlCentreFilter
|
|
43
|
+
if (accessScope.controlCentreFilter) {
|
|
44
|
+
if (entity.controlCentreId !== accessScope.controlCentreFilter) {
|
|
45
|
+
throw new common_1.ForbiddenException(`Access denied: ${entityName} does not belong to your control centre`);
|
|
46
|
+
}
|
|
38
47
|
return;
|
|
39
48
|
}
|
|
40
|
-
throw new common_1.ForbiddenException(`Access denied: Insufficient permissions to access this ${entityName
|
|
49
|
+
throw new common_1.ForbiddenException(`Access denied: Insufficient permissions to access this ${entityName} entity`);
|
|
41
50
|
}
|
|
42
51
|
/**
|
|
43
52
|
* Validates if a user can create an entity with the specified organization/control centre
|
|
@@ -49,76 +58,20 @@ class AccessValidationService {
|
|
|
49
58
|
if (accessScope.isSuperAdmin) {
|
|
50
59
|
return;
|
|
51
60
|
}
|
|
52
|
-
// Check organization level access
|
|
53
61
|
if (createDto.organizationId) {
|
|
54
62
|
if (accessScope.organizationFilter && createDto.organizationId !== accessScope.organizationFilter) {
|
|
55
63
|
throw new common_1.ForbiddenException(`Cannot create ${entityName} for this organization`);
|
|
56
64
|
}
|
|
57
65
|
}
|
|
58
|
-
// Check control centre level access
|
|
59
66
|
if (createDto.controlCentreId) {
|
|
60
67
|
if (accessScope.controlCentreFilter && createDto.controlCentreId !== accessScope.controlCentreFilter) {
|
|
61
68
|
throw new common_1.ForbiddenException(`Cannot create ${entityName} for this control centre`);
|
|
62
69
|
}
|
|
63
70
|
}
|
|
64
|
-
// Ensure user has at least organization or control centre level access
|
|
65
71
|
if (!accessScope.organizationFilter && !accessScope.controlCentreFilter) {
|
|
66
72
|
throw new common_1.ForbiddenException(`Insufficient permissions to create ${entityName}`);
|
|
67
73
|
}
|
|
68
74
|
}
|
|
69
|
-
/**
|
|
70
|
-
* Validates if a user has access to update entities
|
|
71
|
-
* @param accessScope - The access scope for the user
|
|
72
|
-
* @param entityName - The name of the entity (for error messages)
|
|
73
|
-
*/
|
|
74
|
-
validateUpdateAccess(accessScope, entityName = 'entity') {
|
|
75
|
-
if (accessScope.isSuperAdmin) {
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
// Ensure user has at least organization or control centre level access
|
|
79
|
-
if (!accessScope.organizationFilter && !accessScope.controlCentreFilter) {
|
|
80
|
-
throw new common_1.ForbiddenException(`Insufficient permissions to update ${entityName}`);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Validates if a user has access to delete entities
|
|
85
|
-
* @param accessScope - The access scope for the user
|
|
86
|
-
* @param entityName - The name of the entity (for error messages)
|
|
87
|
-
*/
|
|
88
|
-
validateDeleteAccess(accessScope, entityName = 'entity') {
|
|
89
|
-
if (accessScope.isSuperAdmin) {
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
// Ensure user has at least organization or control centre level access
|
|
93
|
-
if (!accessScope.organizationFilter && !accessScope.controlCentreFilter) {
|
|
94
|
-
throw new common_1.ForbiddenException(`Insufficient permissions to delete ${entityName}`);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Validates if a user can update an entity with the specified organization/control centre changes
|
|
99
|
-
* @param accessScope - The access scope for the user
|
|
100
|
-
* @param existingEntity - The existing entity
|
|
101
|
-
* @param updateDto - The DTO containing updated organizationId/controlCentreId
|
|
102
|
-
* @param entityName - The name of the entity (for error messages)
|
|
103
|
-
*/
|
|
104
|
-
validateUpdateEntityAccess(accessScope, existingEntity, updateDto, entityName = 'entity') {
|
|
105
|
-
// First validate access to the existing entity
|
|
106
|
-
this.validateEntityAccess(accessScope, existingEntity, entityName);
|
|
107
|
-
// Then validate update permissions
|
|
108
|
-
this.validateUpdateAccess(accessScope, entityName);
|
|
109
|
-
// If organization is being changed, validate access to new organization
|
|
110
|
-
if (updateDto.organizationId && updateDto.organizationId !== existingEntity.organizationId) {
|
|
111
|
-
if (accessScope.organizationFilter && updateDto.organizationId !== accessScope.organizationFilter) {
|
|
112
|
-
throw new common_1.ForbiddenException(`Cannot move ${entityName} to this organization`);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
// If control centre is being changed, validate access to new control centre
|
|
116
|
-
if (updateDto.controlCentreId && updateDto.controlCentreId !== existingEntity.controlCentreId) {
|
|
117
|
-
if (accessScope.controlCentreFilter && updateDto.controlCentreId !== accessScope.controlCentreFilter) {
|
|
118
|
-
throw new common_1.ForbiddenException(`Cannot move ${entityName} to this control centre`);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
75
|
}
|
|
123
76
|
exports.AccessValidationService = AccessValidationService;
|
|
124
77
|
//# sourceMappingURL=access-validation.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"access-validation.service.js","sourceRoot":"","sources":["../../../../../src/modules/common/services/access-validation.service.ts"],"names":[],"mappings":";;;AAAA,2CAAoD;AAIpD;;;GAGG;AACH,MAAa,uBAAuB;IAEhC;;;;OAIG;IACH,kBAAkB,CAAC,WAAwB,EAAE,mBAA2B,UAAU;QAC9E,IAAI,WAAW,CAAC,YAAY,EAAE,CAAC;YAC3B,OAAO;QACX,CAAC;QAED,IAAI,WAAW,CAAC,kBAAkB,IAAI,WAAW,CAAC,mBAAmB,EAAE,CAAC;YACpE,OAAO;QACX,CAAC;QAED,MAAM,IAAI,2BAAkB,CAAC,qDAAqD,gBAAgB,EAAE,CAAC,CAAC;IAC1G,CAAC;IAED;;;;;OAKG;IACH,oBAAoB,CAChB,WAAwB,EACxB,MAAS,EACT,aAAqB,QAAQ;QAE7B,IAAI,WAAW,CAAC,YAAY,EAAE,CAAC;YAC3B,OAAO;QACX,CAAC;QAED,IAAI,
|
|
1
|
+
{"version":3,"file":"access-validation.service.js","sourceRoot":"","sources":["../../../../../src/modules/common/services/access-validation.service.ts"],"names":[],"mappings":";;;AAAA,2CAAoD;AAIpD;;;GAGG;AACH,MAAa,uBAAuB;IAEhC;;;;OAIG;IACH,kBAAkB,CAAC,WAAwB,EAAE,mBAA2B,UAAU;QAC9E,IAAI,WAAW,CAAC,YAAY,EAAE,CAAC;YAC3B,OAAO;QACX,CAAC;QAED,IAAI,WAAW,CAAC,kBAAkB,IAAI,WAAW,CAAC,mBAAmB,EAAE,CAAC;YACpE,OAAO;QACX,CAAC;QAED,MAAM,IAAI,2BAAkB,CAAC,qDAAqD,gBAAgB,EAAE,CAAC,CAAC;IAC1G,CAAC;IAED;;;;;OAKG;IACH,oBAAoB,CAChB,WAAwB,EACxB,MAAS,EACT,aAAqB,QAAQ;QAE7B,IAAI,WAAW,CAAC,YAAY,EAAE,CAAC;YAC3B,OAAO;QACX,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,cAAc,IAAI,CAAC,MAAM,CAAC,eAAe,EAAE,CAAC;YACpD,MAAM,IAAI,2BAAkB,CAAC,kBAAkB,UAAU,oCAAoC,CAAC,CAAC;QACnG,CAAC;QAED,IAAI,WAAW,CAAC,kBAAkB,EAAE,CAAC;YACjC,IAAI,MAAM,CAAC,cAAc,KAAK,WAAW,CAAC,kBAAkB,EAAE,CAAC;gBAC3D,MAAM,IAAI,2BAAkB,CAAC,kBAAkB,UAAU,uCAAuC,CAAC,CAAC;YACtG,CAAC;YACD,OAAO;QACX,CAAC;QAED,IAAI,WAAW,CAAC,mBAAmB,EAAE,CAAC;YAClC,IAAI,MAAM,CAAC,eAAe,KAAK,WAAW,CAAC,mBAAmB,EAAE,CAAC;gBAC7D,MAAM,IAAI,2BAAkB,CAAC,kBAAkB,UAAU,yCAAyC,CAAC,CAAC;YACxG,CAAC;YACD,OAAO;QACX,CAAC;QAED,MAAM,IAAI,2BAAkB,CAAC,0DAA0D,UAAU,SAAS,CAAC,CAAC;IAChH,CAAC;IAED;;;;;OAKG;IACH,oBAAoB,CAChB,WAAwB,EACxB,SAAY,EACZ,aAAqB,QAAQ;QAE7B,IAAI,WAAW,CAAC,YAAY,EAAE,CAAC;YAC3B,OAAO;QACX,CAAC;QAED,IAAI,SAAS,CAAC,cAAc,EAAE,CAAC;YAC3B,IAAI,WAAW,CAAC,kBAAkB,IAAI,SAAS,CAAC,cAAc,KAAK,WAAW,CAAC,kBAAkB,EAAE,CAAC;gBAChG,MAAM,IAAI,2BAAkB,CAAC,iBAAiB,UAAU,wBAAwB,CAAC,CAAC;YACtF,CAAC;QACL,CAAC;QAED,IAAI,SAAS,CAAC,eAAe,EAAE,CAAC;YAC5B,IAAI,WAAW,CAAC,mBAAmB,IAAI,SAAS,CAAC,eAAe,KAAK,WAAW,CAAC,mBAAmB,EAAE,CAAC;gBACnG,MAAM,IAAI,2BAAkB,CAAC,iBAAiB,UAAU,0BAA0B,CAAC,CAAC;YACxF,CAAC;QACL,CAAC;QAED,IAAI,CAAC,WAAW,CAAC,kBAAkB,IAAI,CAAC,WAAW,CAAC,mBAAmB,EAAE,CAAC;YACtE,MAAM,IAAI,2BAAkB,CAAC,sCAAsC,UAAU,EAAE,CAAC,CAAC;QACrF,CAAC;IACL,CAAC;CAKJ;AA1FD,0DA0FC"}
|
|
@@ -28,13 +28,22 @@ export class AccessValidationService {
|
|
|
28
28
|
if (accessScope.isSuperAdmin) {
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
31
|
-
if (
|
|
31
|
+
if (!entity.organizationId && !entity.controlCentreId) {
|
|
32
|
+
throw new ForbiddenException(`Access denied: ${entityName} has no access control information`);
|
|
33
|
+
}
|
|
34
|
+
if (accessScope.organizationFilter) {
|
|
35
|
+
if (entity.organizationId !== accessScope.organizationFilter) {
|
|
36
|
+
throw new ForbiddenException(`Access denied: ${entityName} does not belong to your organization`);
|
|
37
|
+
}
|
|
32
38
|
return;
|
|
33
39
|
}
|
|
34
|
-
if (accessScope.controlCentreFilter
|
|
40
|
+
if (accessScope.controlCentreFilter) {
|
|
41
|
+
if (entity.controlCentreId !== accessScope.controlCentreFilter) {
|
|
42
|
+
throw new ForbiddenException(`Access denied: ${entityName} does not belong to your control centre`);
|
|
43
|
+
}
|
|
35
44
|
return;
|
|
36
45
|
}
|
|
37
|
-
throw new ForbiddenException(`Access denied: Insufficient permissions to access this ${entityName
|
|
46
|
+
throw new ForbiddenException(`Access denied: Insufficient permissions to access this ${entityName} entity`);
|
|
38
47
|
}
|
|
39
48
|
/**
|
|
40
49
|
* Validates if a user can create an entity with the specified organization/control centre
|
|
@@ -46,75 +55,19 @@ export class AccessValidationService {
|
|
|
46
55
|
if (accessScope.isSuperAdmin) {
|
|
47
56
|
return;
|
|
48
57
|
}
|
|
49
|
-
// Check organization level access
|
|
50
58
|
if (createDto.organizationId) {
|
|
51
59
|
if (accessScope.organizationFilter && createDto.organizationId !== accessScope.organizationFilter) {
|
|
52
60
|
throw new ForbiddenException(`Cannot create ${entityName} for this organization`);
|
|
53
61
|
}
|
|
54
62
|
}
|
|
55
|
-
// Check control centre level access
|
|
56
63
|
if (createDto.controlCentreId) {
|
|
57
64
|
if (accessScope.controlCentreFilter && createDto.controlCentreId !== accessScope.controlCentreFilter) {
|
|
58
65
|
throw new ForbiddenException(`Cannot create ${entityName} for this control centre`);
|
|
59
66
|
}
|
|
60
67
|
}
|
|
61
|
-
// Ensure user has at least organization or control centre level access
|
|
62
68
|
if (!accessScope.organizationFilter && !accessScope.controlCentreFilter) {
|
|
63
69
|
throw new ForbiddenException(`Insufficient permissions to create ${entityName}`);
|
|
64
70
|
}
|
|
65
71
|
}
|
|
66
|
-
/**
|
|
67
|
-
* Validates if a user has access to update entities
|
|
68
|
-
* @param accessScope - The access scope for the user
|
|
69
|
-
* @param entityName - The name of the entity (for error messages)
|
|
70
|
-
*/
|
|
71
|
-
validateUpdateAccess(accessScope, entityName = 'entity') {
|
|
72
|
-
if (accessScope.isSuperAdmin) {
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
// Ensure user has at least organization or control centre level access
|
|
76
|
-
if (!accessScope.organizationFilter && !accessScope.controlCentreFilter) {
|
|
77
|
-
throw new ForbiddenException(`Insufficient permissions to update ${entityName}`);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Validates if a user has access to delete entities
|
|
82
|
-
* @param accessScope - The access scope for the user
|
|
83
|
-
* @param entityName - The name of the entity (for error messages)
|
|
84
|
-
*/
|
|
85
|
-
validateDeleteAccess(accessScope, entityName = 'entity') {
|
|
86
|
-
if (accessScope.isSuperAdmin) {
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
// Ensure user has at least organization or control centre level access
|
|
90
|
-
if (!accessScope.organizationFilter && !accessScope.controlCentreFilter) {
|
|
91
|
-
throw new ForbiddenException(`Insufficient permissions to delete ${entityName}`);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Validates if a user can update an entity with the specified organization/control centre changes
|
|
96
|
-
* @param accessScope - The access scope for the user
|
|
97
|
-
* @param existingEntity - The existing entity
|
|
98
|
-
* @param updateDto - The DTO containing updated organizationId/controlCentreId
|
|
99
|
-
* @param entityName - The name of the entity (for error messages)
|
|
100
|
-
*/
|
|
101
|
-
validateUpdateEntityAccess(accessScope, existingEntity, updateDto, entityName = 'entity') {
|
|
102
|
-
// First validate access to the existing entity
|
|
103
|
-
this.validateEntityAccess(accessScope, existingEntity, entityName);
|
|
104
|
-
// Then validate update permissions
|
|
105
|
-
this.validateUpdateAccess(accessScope, entityName);
|
|
106
|
-
// If organization is being changed, validate access to new organization
|
|
107
|
-
if (updateDto.organizationId && updateDto.organizationId !== existingEntity.organizationId) {
|
|
108
|
-
if (accessScope.organizationFilter && updateDto.organizationId !== accessScope.organizationFilter) {
|
|
109
|
-
throw new ForbiddenException(`Cannot move ${entityName} to this organization`);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
// If control centre is being changed, validate access to new control centre
|
|
113
|
-
if (updateDto.controlCentreId && updateDto.controlCentreId !== existingEntity.controlCentreId) {
|
|
114
|
-
if (accessScope.controlCentreFilter && updateDto.controlCentreId !== accessScope.controlCentreFilter) {
|
|
115
|
-
throw new ForbiddenException(`Cannot move ${entityName} to this control centre`);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
72
|
}
|
|
120
73
|
//# sourceMappingURL=access-validation.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"access-validation.service.js","sourceRoot":"","sources":["../../../../../src/modules/common/services/access-validation.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAIpD;;;GAGG;AACH,MAAM,OAAO,uBAAuB;IAEhC;;;;OAIG;IACH,kBAAkB,CAAC,WAAwB,EAAE,mBAA2B,UAAU;QAC9E,IAAI,WAAW,CAAC,YAAY,EAAE,CAAC;YAC3B,OAAO;QACX,CAAC;QAED,IAAI,WAAW,CAAC,kBAAkB,IAAI,WAAW,CAAC,mBAAmB,EAAE,CAAC;YACpE,OAAO;QACX,CAAC;QAED,MAAM,IAAI,kBAAkB,CAAC,qDAAqD,gBAAgB,EAAE,CAAC,CAAC;IAC1G,CAAC;IAED;;;;;OAKG;IACH,oBAAoB,CAChB,WAAwB,EACxB,MAAS,EACT,aAAqB,QAAQ;QAE7B,IAAI,WAAW,CAAC,YAAY,EAAE,CAAC;YAC3B,OAAO;QACX,CAAC;QAED,IAAI,
|
|
1
|
+
{"version":3,"file":"access-validation.service.js","sourceRoot":"","sources":["../../../../../src/modules/common/services/access-validation.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAIpD;;;GAGG;AACH,MAAM,OAAO,uBAAuB;IAEhC;;;;OAIG;IACH,kBAAkB,CAAC,WAAwB,EAAE,mBAA2B,UAAU;QAC9E,IAAI,WAAW,CAAC,YAAY,EAAE,CAAC;YAC3B,OAAO;QACX,CAAC;QAED,IAAI,WAAW,CAAC,kBAAkB,IAAI,WAAW,CAAC,mBAAmB,EAAE,CAAC;YACpE,OAAO;QACX,CAAC;QAED,MAAM,IAAI,kBAAkB,CAAC,qDAAqD,gBAAgB,EAAE,CAAC,CAAC;IAC1G,CAAC;IAED;;;;;OAKG;IACH,oBAAoB,CAChB,WAAwB,EACxB,MAAS,EACT,aAAqB,QAAQ;QAE7B,IAAI,WAAW,CAAC,YAAY,EAAE,CAAC;YAC3B,OAAO;QACX,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,cAAc,IAAI,CAAC,MAAM,CAAC,eAAe,EAAE,CAAC;YACpD,MAAM,IAAI,kBAAkB,CAAC,kBAAkB,UAAU,oCAAoC,CAAC,CAAC;QACnG,CAAC;QAED,IAAI,WAAW,CAAC,kBAAkB,EAAE,CAAC;YACjC,IAAI,MAAM,CAAC,cAAc,KAAK,WAAW,CAAC,kBAAkB,EAAE,CAAC;gBAC3D,MAAM,IAAI,kBAAkB,CAAC,kBAAkB,UAAU,uCAAuC,CAAC,CAAC;YACtG,CAAC;YACD,OAAO;QACX,CAAC;QAED,IAAI,WAAW,CAAC,mBAAmB,EAAE,CAAC;YAClC,IAAI,MAAM,CAAC,eAAe,KAAK,WAAW,CAAC,mBAAmB,EAAE,CAAC;gBAC7D,MAAM,IAAI,kBAAkB,CAAC,kBAAkB,UAAU,yCAAyC,CAAC,CAAC;YACxG,CAAC;YACD,OAAO;QACX,CAAC;QAED,MAAM,IAAI,kBAAkB,CAAC,0DAA0D,UAAU,SAAS,CAAC,CAAC;IAChH,CAAC;IAED;;;;;OAKG;IACH,oBAAoB,CAChB,WAAwB,EACxB,SAAY,EACZ,aAAqB,QAAQ;QAE7B,IAAI,WAAW,CAAC,YAAY,EAAE,CAAC;YAC3B,OAAO;QACX,CAAC;QAED,IAAI,SAAS,CAAC,cAAc,EAAE,CAAC;YAC3B,IAAI,WAAW,CAAC,kBAAkB,IAAI,SAAS,CAAC,cAAc,KAAK,WAAW,CAAC,kBAAkB,EAAE,CAAC;gBAChG,MAAM,IAAI,kBAAkB,CAAC,iBAAiB,UAAU,wBAAwB,CAAC,CAAC;YACtF,CAAC;QACL,CAAC;QAED,IAAI,SAAS,CAAC,eAAe,EAAE,CAAC;YAC5B,IAAI,WAAW,CAAC,mBAAmB,IAAI,SAAS,CAAC,eAAe,KAAK,WAAW,CAAC,mBAAmB,EAAE,CAAC;gBACnG,MAAM,IAAI,kBAAkB,CAAC,iBAAiB,UAAU,0BAA0B,CAAC,CAAC;YACxF,CAAC;QACL,CAAC;QAED,IAAI,CAAC,WAAW,CAAC,kBAAkB,IAAI,CAAC,WAAW,CAAC,mBAAmB,EAAE,CAAC;YACtE,MAAM,IAAI,kBAAkB,CAAC,sCAAsC,UAAU,EAAE,CAAC,CAAC;QACrF,CAAC;IACL,CAAC;CAKJ"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AccessScope } from '../../user/interfaces/access-scope';
|
|
2
|
-
import { EntityAccessCheck, CreateEntityAccessCheck
|
|
2
|
+
import { EntityAccessCheck, CreateEntityAccessCheck } from '../interfaces/access-validation.interface';
|
|
3
3
|
/**
|
|
4
4
|
* Service for validating access control across microservices
|
|
5
5
|
* Provides centralized validation logic to ensure consistency
|
|
@@ -25,24 +25,4 @@ export declare class AccessValidationService {
|
|
|
25
25
|
* @param entityName - The name of the entity (for error messages)
|
|
26
26
|
*/
|
|
27
27
|
validateCreateAccess<T extends CreateEntityAccessCheck>(accessScope: AccessScope, createDto: T, entityName?: string): void;
|
|
28
|
-
/**
|
|
29
|
-
* Validates if a user has access to update entities
|
|
30
|
-
* @param accessScope - The access scope for the user
|
|
31
|
-
* @param entityName - The name of the entity (for error messages)
|
|
32
|
-
*/
|
|
33
|
-
validateUpdateAccess(accessScope: AccessScope, entityName?: string): void;
|
|
34
|
-
/**
|
|
35
|
-
* Validates if a user has access to delete entities
|
|
36
|
-
* @param accessScope - The access scope for the user
|
|
37
|
-
* @param entityName - The name of the entity (for error messages)
|
|
38
|
-
*/
|
|
39
|
-
validateDeleteAccess(accessScope: AccessScope, entityName?: string): void;
|
|
40
|
-
/**
|
|
41
|
-
* Validates if a user can update an entity with the specified organization/control centre changes
|
|
42
|
-
* @param accessScope - The access scope for the user
|
|
43
|
-
* @param existingEntity - The existing entity
|
|
44
|
-
* @param updateDto - The DTO containing updated organizationId/controlCentreId
|
|
45
|
-
* @param entityName - The name of the entity (for error messages)
|
|
46
|
-
*/
|
|
47
|
-
validateUpdateEntityAccess<T extends EntityAccessCheck, U extends UpdateEntityAccessCheck>(accessScope: AccessScope, existingEntity: T, updateDto: U, entityName?: string): void;
|
|
48
28
|
}
|