@flusys/ng-iam 1.0.0-rc → 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/README.md +1 -1
- package/fesm2022/{flusys-ng-iam-action-form-page.component-C_BRrrWW.mjs → flusys-ng-iam-action-form-page.component-CVN8sV-c.mjs} +11 -61
- package/fesm2022/flusys-ng-iam-action-form-page.component-CVN8sV-c.mjs.map +1 -0
- package/fesm2022/{flusys-ng-iam-action-list-page.component-Daf93zpS.mjs → flusys-ng-iam-action-list-page.component-CQ6RazN0.mjs} +19 -46
- package/fesm2022/flusys-ng-iam-action-list-page.component-CQ6RazN0.mjs.map +1 -0
- package/fesm2022/{flusys-ng-iam-flusys-ng-iam-BPIpfrjN.mjs → flusys-ng-iam-flusys-ng-iam-DrGHlTiz.mjs} +251 -813
- package/fesm2022/flusys-ng-iam-flusys-ng-iam-DrGHlTiz.mjs.map +1 -0
- package/fesm2022/{flusys-ng-iam-iam-container.component-Bn4kQtxW.mjs → flusys-ng-iam-iam-container.component-BToYxEej.mjs} +2 -2
- package/fesm2022/flusys-ng-iam-iam-container.component-BToYxEej.mjs.map +1 -0
- package/fesm2022/{flusys-ng-iam-permission-page.component-CmxOBJPu.mjs → flusys-ng-iam-permission-page.component-BS7xXmsn.mjs} +8 -43
- package/fesm2022/flusys-ng-iam-permission-page.component-BS7xXmsn.mjs.map +1 -0
- package/fesm2022/{flusys-ng-iam-role-form-page.component-ByNueI1a.mjs → flusys-ng-iam-role-form-page.component-BjPwXkip.mjs} +2 -16
- package/fesm2022/flusys-ng-iam-role-form-page.component-BjPwXkip.mjs.map +1 -0
- package/fesm2022/{flusys-ng-iam-role-list-page.component-CFly5KnH.mjs → flusys-ng-iam-role-list-page.component-Cz-jk-R_.mjs} +3 -20
- package/fesm2022/flusys-ng-iam-role-list-page.component-Cz-jk-R_.mjs.map +1 -0
- package/fesm2022/flusys-ng-iam.mjs +1 -1
- package/package.json +11 -11
- package/types/flusys-ng-iam.d.ts +46 -444
- package/fesm2022/flusys-ng-iam-action-form-page.component-C_BRrrWW.mjs.map +0 -1
- package/fesm2022/flusys-ng-iam-action-list-page.component-Daf93zpS.mjs.map +0 -1
- package/fesm2022/flusys-ng-iam-flusys-ng-iam-BPIpfrjN.mjs.map +0 -1
- package/fesm2022/flusys-ng-iam-iam-container.component-Bn4kQtxW.mjs.map +0 -1
- package/fesm2022/flusys-ng-iam-permission-page.component-CmxOBJPu.mjs.map +0 -1
- package/fesm2022/flusys-ng-iam-role-form-page.component-ByNueI1a.mjs.map +0 -1
- package/fesm2022/flusys-ng-iam-role-list-page.component-CFly5KnH.mjs.map +0 -1
package/types/flusys-ng-iam.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IBaseEntity, ILogicNode, ApiResourceService, ISingleResponse, IProfilePermissionProvider, IProfileRoleInfo, IProfileActionInfo } from '@flusys/ng-shared';
|
|
2
2
|
import * as _angular_core from '@angular/core';
|
|
3
|
-
import {
|
|
3
|
+
import { Provider } from '@angular/core';
|
|
4
4
|
import { Observable } from 'rxjs';
|
|
5
5
|
import { BaseApiService } from '@flusys/ng-core';
|
|
6
6
|
export { PermissionMode } from '@flusys/ng-core';
|
|
@@ -36,10 +36,6 @@ interface IBranch {
|
|
|
36
36
|
companyId: string;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
/**
|
|
40
|
-
* Role Response DTO
|
|
41
|
-
* Matches backend RoleResponseDto
|
|
42
|
-
*/
|
|
43
39
|
interface IRole extends IBaseEntity {
|
|
44
40
|
readOnly: boolean;
|
|
45
41
|
name: string;
|
|
@@ -49,10 +45,6 @@ interface IRole extends IBaseEntity {
|
|
|
49
45
|
serial: number | null;
|
|
50
46
|
metadata: Record<string, unknown> | null;
|
|
51
47
|
}
|
|
52
|
-
/**
|
|
53
|
-
* Create Role DTO
|
|
54
|
-
* Matches backend CreateRoleDto
|
|
55
|
-
*/
|
|
56
48
|
interface ICreateRoleDto {
|
|
57
49
|
name: string;
|
|
58
50
|
description?: string;
|
|
@@ -61,35 +53,20 @@ interface ICreateRoleDto {
|
|
|
61
53
|
serial?: number;
|
|
62
54
|
metadata?: Record<string, unknown>;
|
|
63
55
|
}
|
|
64
|
-
/**
|
|
65
|
-
* Update Role DTO
|
|
66
|
-
* Matches backend UpdateRoleDto
|
|
67
|
-
*/
|
|
68
56
|
interface IUpdateRoleDto extends Partial<ICreateRoleDto> {
|
|
69
57
|
id: string;
|
|
70
58
|
}
|
|
71
|
-
/**
|
|
72
|
-
* Role Query DTO
|
|
73
|
-
* Matches backend RoleQueryDto
|
|
74
|
-
*/
|
|
75
59
|
interface IRoleQueryDto {
|
|
76
60
|
companyId?: string;
|
|
77
61
|
isActive?: boolean;
|
|
78
62
|
}
|
|
79
63
|
|
|
80
|
-
/**
|
|
81
|
-
* Action Type - determines how action is used
|
|
82
|
-
* CRITICAL: Must match backend ActionType enum exactly
|
|
83
|
-
*/
|
|
64
|
+
/** Must match backend ActionType enum */
|
|
84
65
|
declare enum ActionType {
|
|
85
|
-
BACKEND = "backend"
|
|
86
|
-
FRONTEND = "frontend"
|
|
66
|
+
BACKEND = "backend",
|
|
67
|
+
FRONTEND = "frontend",
|
|
87
68
|
BOTH = "both"
|
|
88
69
|
}
|
|
89
|
-
/**
|
|
90
|
-
* Action Response DTO
|
|
91
|
-
* Matches backend ActionResponseDto
|
|
92
|
-
*/
|
|
93
70
|
interface IAction extends IBaseEntity {
|
|
94
71
|
readOnly: boolean;
|
|
95
72
|
name: string;
|
|
@@ -102,17 +79,9 @@ interface IAction extends IBaseEntity {
|
|
|
102
79
|
isActive: boolean;
|
|
103
80
|
metadata: Record<string, unknown> | null;
|
|
104
81
|
}
|
|
105
|
-
/**
|
|
106
|
-
* Action Tree DTO
|
|
107
|
-
* Hierarchical action structure
|
|
108
|
-
*/
|
|
109
82
|
interface IActionTreeDto extends IAction {
|
|
110
83
|
children: IActionTreeDto[];
|
|
111
84
|
}
|
|
112
|
-
/**
|
|
113
|
-
* Create Action DTO
|
|
114
|
-
* Matches backend CreateActionDto
|
|
115
|
-
*/
|
|
116
85
|
interface ICreateActionDto {
|
|
117
86
|
name: string;
|
|
118
87
|
description?: string;
|
|
@@ -124,76 +93,35 @@ interface ICreateActionDto {
|
|
|
124
93
|
isActive?: boolean;
|
|
125
94
|
metadata?: Record<string, unknown>;
|
|
126
95
|
}
|
|
127
|
-
/**
|
|
128
|
-
* Update Action DTO
|
|
129
|
-
* Matches backend UpdateActionDto
|
|
130
|
-
*/
|
|
131
96
|
interface IUpdateActionDto extends Partial<ICreateActionDto> {
|
|
132
97
|
id: string;
|
|
133
98
|
}
|
|
134
99
|
|
|
135
|
-
/**
|
|
136
|
-
* Permission Action - 'add' or 'remove'
|
|
137
|
-
*/
|
|
138
100
|
type PermissionAction = 'add' | 'remove';
|
|
139
|
-
/**
|
|
140
|
-
* Permission Item DTO
|
|
141
|
-
* Used in all assignment operations
|
|
142
|
-
*/
|
|
143
101
|
interface IPermissionItemDto {
|
|
144
102
|
id: string;
|
|
145
103
|
action: PermissionAction;
|
|
146
104
|
}
|
|
147
|
-
/**
|
|
148
|
-
* Assign User Actions DTO
|
|
149
|
-
* Assign/remove actions directly to/from user (DIRECT/FULL mode)
|
|
150
|
-
*
|
|
151
|
-
* Permission Granularity:
|
|
152
|
-
* - companyId + branchId = undefined: Global (super admin)
|
|
153
|
-
* - companyId set + branchId = undefined: Company-wide (all branches)
|
|
154
|
-
* - companyId set + branchId set: Branch-specific
|
|
155
|
-
*/
|
|
156
105
|
interface IAssignUserActionsDto {
|
|
157
106
|
userId: string;
|
|
158
107
|
companyId?: string;
|
|
159
108
|
branchId?: string;
|
|
160
109
|
items: IPermissionItemDto[];
|
|
161
110
|
}
|
|
162
|
-
/**
|
|
163
|
-
* Assign Company Actions DTO
|
|
164
|
-
* Whitelist actions for company (if company feature enabled)
|
|
165
|
-
*/
|
|
166
111
|
interface IAssignCompanyActionsDto {
|
|
167
112
|
companyId: string;
|
|
168
113
|
items: IPermissionItemDto[];
|
|
169
114
|
}
|
|
170
|
-
/**
|
|
171
|
-
* Assign Role Actions DTO
|
|
172
|
-
* Assign/remove actions to/from role (RBAC/FULL mode)
|
|
173
|
-
*/
|
|
174
115
|
interface IAssignRoleActionsDto {
|
|
175
116
|
roleId: string;
|
|
176
117
|
items: IPermissionItemDto[];
|
|
177
118
|
}
|
|
178
|
-
/**
|
|
179
|
-
* Assign User Roles DTO
|
|
180
|
-
* Assign/remove roles to/from user (RBAC/FULL mode)
|
|
181
|
-
*
|
|
182
|
-
* Permission Granularity:
|
|
183
|
-
* - companyId + branchId = undefined: Global (super admin)
|
|
184
|
-
* - companyId set + branchId = undefined: Company-wide (all branches)
|
|
185
|
-
* - companyId set + branchId set: Branch-specific
|
|
186
|
-
*/
|
|
187
119
|
interface IAssignUserRolesDto {
|
|
188
120
|
userId: string;
|
|
189
121
|
companyId?: string;
|
|
190
122
|
branchId?: string;
|
|
191
123
|
items: IPermissionItemDto[];
|
|
192
124
|
}
|
|
193
|
-
/**
|
|
194
|
-
* User Action Response DTO
|
|
195
|
-
* Direct user → action permissions (branch-scoped if company feature enabled)
|
|
196
|
-
*/
|
|
197
125
|
interface IUserActionResponseDto {
|
|
198
126
|
id: string;
|
|
199
127
|
userId: string;
|
|
@@ -203,10 +131,6 @@ interface IUserActionResponseDto {
|
|
|
203
131
|
branchId: string | null;
|
|
204
132
|
createdAt: Date;
|
|
205
133
|
}
|
|
206
|
-
/**
|
|
207
|
-
* Role Action Response DTO
|
|
208
|
-
* Role → action permissions (NOT branch-scoped)
|
|
209
|
-
*/
|
|
210
134
|
interface IRoleActionResponseDto {
|
|
211
135
|
id: string;
|
|
212
136
|
roleId: string;
|
|
@@ -215,10 +139,6 @@ interface IRoleActionResponseDto {
|
|
|
215
139
|
actionName: string;
|
|
216
140
|
createdAt: Date;
|
|
217
141
|
}
|
|
218
|
-
/**
|
|
219
|
-
* Company Action Response DTO
|
|
220
|
-
* Company → action whitelist
|
|
221
|
-
*/
|
|
222
142
|
interface ICompanyActionResponseDto {
|
|
223
143
|
id: string;
|
|
224
144
|
companyId: string;
|
|
@@ -227,10 +147,6 @@ interface ICompanyActionResponseDto {
|
|
|
227
147
|
actionName: string;
|
|
228
148
|
createdAt: Date;
|
|
229
149
|
}
|
|
230
|
-
/**
|
|
231
|
-
* User Role Response DTO
|
|
232
|
-
* User → role assignments (NOT branch-scoped)
|
|
233
|
-
*/
|
|
234
150
|
interface IUserRoleResponseDto {
|
|
235
151
|
id: string;
|
|
236
152
|
userId: string;
|
|
@@ -240,24 +156,6 @@ interface IUserRoleResponseDto {
|
|
|
240
156
|
branchId: string | null;
|
|
241
157
|
createdAt: Date;
|
|
242
158
|
}
|
|
243
|
-
/**
|
|
244
|
-
* Menu item from IAM permissions (menu-type actions)
|
|
245
|
-
*/
|
|
246
|
-
interface IMenuAction {
|
|
247
|
-
id: string;
|
|
248
|
-
code: string;
|
|
249
|
-
name: string;
|
|
250
|
-
route: string | null;
|
|
251
|
-
icon: string | null;
|
|
252
|
-
iconType: number | null;
|
|
253
|
-
serial: number | null;
|
|
254
|
-
parentId: string | null;
|
|
255
|
-
children?: IMenuAction[];
|
|
256
|
-
}
|
|
257
|
-
/**
|
|
258
|
-
* My Permissions Response DTO
|
|
259
|
-
* Complete user permissions (frontend actions, cached endpoints, menus)
|
|
260
|
-
*/
|
|
261
159
|
interface IMyPermissionsResponseDto {
|
|
262
160
|
frontendActions: Array<{
|
|
263
161
|
id: string;
|
|
@@ -267,29 +165,17 @@ interface IMyPermissionsResponseDto {
|
|
|
267
165
|
}>;
|
|
268
166
|
cachedEndpoints: number;
|
|
269
167
|
}
|
|
270
|
-
/**
|
|
271
|
-
* Prerequisite Action DTO
|
|
272
|
-
* Action required as a prerequisite
|
|
273
|
-
*/
|
|
274
168
|
interface IPrerequisiteActionDto {
|
|
275
169
|
actionId: string;
|
|
276
170
|
actionCode: string;
|
|
277
171
|
actionName: string;
|
|
278
172
|
}
|
|
279
|
-
/**
|
|
280
|
-
* Prerequisite Validation Error
|
|
281
|
-
* Describes an action that failed prerequisite validation
|
|
282
|
-
*/
|
|
283
173
|
interface IPrerequisiteValidationError {
|
|
284
174
|
actionId: string;
|
|
285
175
|
actionCode: string;
|
|
286
176
|
actionName: string;
|
|
287
177
|
requiredActions: IPrerequisiteActionDto[];
|
|
288
178
|
}
|
|
289
|
-
/**
|
|
290
|
-
* Permission Operation Result DTO
|
|
291
|
-
* Result of assignment operations
|
|
292
|
-
*/
|
|
293
179
|
interface IPermissionOperationResultDto {
|
|
294
180
|
success: boolean;
|
|
295
181
|
added: number;
|
|
@@ -297,218 +183,60 @@ interface IPermissionOperationResultDto {
|
|
|
297
183
|
message: string;
|
|
298
184
|
prerequisiteErrors?: IPrerequisiteValidationError[];
|
|
299
185
|
}
|
|
300
|
-
/**
|
|
301
|
-
* Get User Actions DTO
|
|
302
|
-
* Optional branchId filter
|
|
303
|
-
*/
|
|
304
186
|
interface IGetUserActionsDto {
|
|
305
187
|
branchId?: string;
|
|
306
188
|
}
|
|
307
|
-
/**
|
|
308
|
-
* Get Role Actions DTO
|
|
309
|
-
* No parameters
|
|
310
|
-
*/
|
|
311
189
|
interface IGetRoleActionsDto {
|
|
312
190
|
}
|
|
313
|
-
/**
|
|
314
|
-
* Get User Roles DTO
|
|
315
|
-
* Optional branchId filter (ignored - roles are NOT branch-scoped)
|
|
316
|
-
*/
|
|
317
191
|
interface IGetUserRolesDto {
|
|
318
192
|
branchId?: string;
|
|
319
193
|
}
|
|
320
|
-
/**
|
|
321
|
-
* Get My Permissions DTO
|
|
322
|
-
* Optional parentCodes filter for frontend actions
|
|
323
|
-
*/
|
|
324
194
|
interface IGetMyPermissionsDto {
|
|
325
195
|
parentCodes?: string[];
|
|
326
196
|
}
|
|
327
197
|
|
|
328
|
-
/**
|
|
329
|
-
* Pagination Constants
|
|
330
|
-
*
|
|
331
|
-
* Standard pagination limits for IAM components.
|
|
332
|
-
* Prevents excessive data loading and potential DoS.
|
|
333
|
-
*/
|
|
334
|
-
/**
|
|
335
|
-
* Maximum items to fetch for dropdown lists
|
|
336
|
-
* Used for: companies, roles, users, branches
|
|
337
|
-
*
|
|
338
|
-
* Security: Prevents memory exhaustion from loading excessive records
|
|
339
|
-
*/
|
|
198
|
+
/** Maximum items for dropdown lists (companies, roles, users, branches) */
|
|
340
199
|
declare const MAX_DROPDOWN_ITEMS = 100;
|
|
341
200
|
|
|
342
|
-
/**
|
|
343
|
-
* Role API Service
|
|
344
|
-
* Handles role CRUD operations
|
|
345
|
-
* Endpoint: POST /iam/roles/*
|
|
346
|
-
* Conditional: Only available in RBAC/FULL mode
|
|
347
|
-
*/
|
|
348
201
|
declare class RoleApiService extends ApiResourceService<IUpdateRoleDto, IRole> {
|
|
349
202
|
constructor();
|
|
350
203
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<RoleApiService, never>;
|
|
351
204
|
static ɵprov: _angular_core.ɵɵInjectableDeclaration<RoleApiService>;
|
|
352
205
|
}
|
|
353
206
|
|
|
354
|
-
/**
|
|
355
|
-
* Action API Service
|
|
356
|
-
* Handles action CRUD operations
|
|
357
|
-
* Endpoint: POST /iam/actions/*
|
|
358
|
-
*/
|
|
359
207
|
declare class ActionApiService extends ApiResourceService<IUpdateActionDto, IAction> {
|
|
360
208
|
private readonly appConfig;
|
|
361
209
|
constructor();
|
|
362
|
-
/**
|
|
363
|
-
* Get actions for permission assignment
|
|
364
|
-
* POST /iam/actions/tree-for-permission
|
|
365
|
-
* Returns actions filtered by company whitelist if enabled
|
|
366
|
-
*/
|
|
210
|
+
/** Get actions filtered by company whitelist for permission assignment */
|
|
367
211
|
getActionsForPermission(): Observable<ISingleResponse<IActionTreeDto[]>>;
|
|
368
|
-
/**
|
|
369
|
-
* Get actions in hierarchical tree structure
|
|
370
|
-
* POST /iam/actions/tree
|
|
371
|
-
* Returns all actions organized in parent-child tree
|
|
372
|
-
*
|
|
373
|
-
* @param search - Optional search term (name or code)
|
|
374
|
-
* @param isActive - Optional filter by active status
|
|
375
|
-
* @param withDeleted - Include deleted actions (default: false)
|
|
376
|
-
* @returns Observable of action tree response
|
|
377
|
-
*/
|
|
212
|
+
/** Get actions in hierarchical tree structure */
|
|
378
213
|
getTree(search?: string, isActive?: boolean, withDeleted?: boolean): Observable<ISingleResponse<IActionTreeDto[]>>;
|
|
379
214
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ActionApiService, never>;
|
|
380
215
|
static ɵprov: _angular_core.ɵɵInjectableDeclaration<ActionApiService>;
|
|
381
216
|
}
|
|
382
217
|
|
|
383
|
-
/**
|
|
384
|
-
* Action Permission Logic Service
|
|
385
|
-
*
|
|
386
|
-
* Shared service for handling smart dependency management across all action selectors:
|
|
387
|
-
* - Company-Action Selector
|
|
388
|
-
* - Role-Action Selector
|
|
389
|
-
* - User-Action Selector
|
|
390
|
-
*
|
|
391
|
-
* **Core Features:**
|
|
392
|
-
* - Smart auto-selection (AND/OR optimization)
|
|
393
|
-
* - Dependency detection and management
|
|
394
|
-
* - Alternative suggestion for OR logic
|
|
395
|
-
* - Visual formatting of permission logic trees
|
|
396
|
-
* - Prerequisite validation
|
|
397
|
-
*
|
|
398
|
-
* @example
|
|
399
|
-
* constructor() {
|
|
400
|
-
* this.permissionLogic = inject(ActionPermissionLogicService);
|
|
401
|
-
* }
|
|
402
|
-
*
|
|
403
|
-
* onActionToggle(action: IAction, newValue: boolean) {
|
|
404
|
-
* if (!newValue) {
|
|
405
|
-
* this.permissionLogic.handleUncheck(
|
|
406
|
-
* action,
|
|
407
|
-
* this.selectionMap(),
|
|
408
|
-
* this.actions(),
|
|
409
|
-
* (newMap) => this.selectionMap.set(newMap)
|
|
410
|
-
* );
|
|
411
|
-
* } else {
|
|
412
|
-
* this.permissionLogic.handleCheck(
|
|
413
|
-
* action,
|
|
414
|
-
* this.selectionMap(),
|
|
415
|
-
* this.actions(),
|
|
416
|
-
* (newMap) => this.selectionMap.set(newMap),
|
|
417
|
-
* (previousState) => this.selectionMap.set(previousState)
|
|
418
|
-
* );
|
|
419
|
-
* }
|
|
420
|
-
* }
|
|
421
|
-
*/
|
|
218
|
+
/** Shared service for smart dependency management across action selectors */
|
|
422
219
|
declare class ActionPermissionLogicService {
|
|
423
220
|
private readonly confirmationService;
|
|
424
221
|
private readonly messageService;
|
|
425
|
-
/**
|
|
426
|
-
* Handle checking an action with prerequisite validation
|
|
427
|
-
*
|
|
428
|
-
* Uses recursive deep scan to find ALL missing prerequisites at all levels,
|
|
429
|
-
* not just direct dependencies. This ensures cascading dependencies are
|
|
430
|
-
* resolved in a single step.
|
|
431
|
-
*
|
|
432
|
-
* @param action - Action being checked
|
|
433
|
-
* @param currentSelection - Current selection map
|
|
434
|
-
* @param allActions - All available actions
|
|
435
|
-
* @param onUpdate - Callback to update selection
|
|
436
|
-
* @param onCancel - Callback when user cancels
|
|
437
|
-
*/
|
|
222
|
+
/** Handle checking an action with prerequisite validation (recursive deep scan) */
|
|
438
223
|
handleCheck(action: IAction, currentSelection: Record<string, boolean>, allActions: IAction[], onUpdate: (newSelection: Record<string, boolean>) => void, onCancel: (previousState: Record<string, boolean>) => void): void;
|
|
439
|
-
/**
|
|
440
|
-
* Handle unchecking an action with dependency detection
|
|
441
|
-
*
|
|
442
|
-
* @param action - Action being unchecked
|
|
443
|
-
* @param currentSelection - Current selection map
|
|
444
|
-
* @param allActions - All available actions
|
|
445
|
-
* @param onUpdate - Callback to update selection
|
|
446
|
-
*/
|
|
224
|
+
/** Handle unchecking an action with dependency detection */
|
|
447
225
|
handleUncheck(action: IAction, currentSelection: Record<string, boolean>, allActions: IAction[], onUpdate: (newSelection: Record<string, boolean>) => void): void;
|
|
448
|
-
/**
|
|
449
|
-
* Check if an action has unmet prerequisites
|
|
450
|
-
*
|
|
451
|
-
* @param action - Action to check
|
|
452
|
-
* @param currentSelection - Current selection map
|
|
453
|
-
* @param allActions - All available actions
|
|
454
|
-
* @returns True if action has unmet prerequisites
|
|
455
|
-
*/
|
|
226
|
+
/** Check if an action has unmet prerequisites */
|
|
456
227
|
hasUnmetPrerequisites(action: IAction, currentSelection: Record<string, boolean>, allActions: IAction[]): boolean;
|
|
457
|
-
/**
|
|
458
|
-
* Get all selected actions that have unmet prerequisites
|
|
459
|
-
*
|
|
460
|
-
* @param currentSelection - Current selection map
|
|
461
|
-
* @param allActions - All available actions
|
|
462
|
-
* @returns Array of actions with unmet prerequisites
|
|
463
|
-
*/
|
|
228
|
+
/** Get all selected actions that have unmet prerequisites */
|
|
464
229
|
getActionsWithUnmetPrerequisites(currentSelection: Record<string, boolean>, allActions: IAction[]): IAction[];
|
|
465
|
-
/**
|
|
466
|
-
* Show validation error dialog with auto-fix options
|
|
467
|
-
*
|
|
468
|
-
* @param invalidActions - Actions with unmet prerequisites
|
|
469
|
-
* @param currentSelection - Current selection map
|
|
470
|
-
* @param allActions - All available actions
|
|
471
|
-
* @param onUpdate - Callback to update selection
|
|
472
|
-
*/
|
|
230
|
+
/** Show validation error dialog with auto-fix options */
|
|
473
231
|
showValidationErrorDialog(invalidActions: IAction[], currentSelection: Record<string, boolean>, allActions: IAction[], onUpdate: (newSelection: Record<string, boolean>) => void): void;
|
|
474
|
-
/**
|
|
475
|
-
* Get prerequisite description for tooltip display
|
|
476
|
-
*
|
|
477
|
-
* @param action - Action to get prerequisites for
|
|
478
|
-
* @param currentSelection - Current selection map
|
|
479
|
-
* @param allActions - All available actions
|
|
480
|
-
* @returns Plain text prerequisite description
|
|
481
|
-
*/
|
|
232
|
+
/** Get prerequisite description for tooltip display */
|
|
482
233
|
getPrerequisiteTooltip(action: IAction, currentSelection: Record<string, boolean>, allActions: IAction[]): string;
|
|
483
|
-
/**
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
* @param missingActions - Actions that are missing
|
|
488
|
-
* @param allActions - All available actions
|
|
489
|
-
* @param currentSelection - Current selection map for accurate status
|
|
490
|
-
* @returns HTML formatted logic tree
|
|
491
|
-
*/
|
|
492
|
-
buildLogicMessage(logic: ILogicNode, missingActions: IAction[], allActions: IAction[], currentSelection?: Record<string, boolean>): string;
|
|
234
|
+
/** Build dynamic logic tree message with AND/OR operators and nesting */
|
|
235
|
+
buildLogicMessage(logic: ILogicNode, _missingActions: IAction[], allActions: IAction[], currentSelection?: Record<string, boolean>): string;
|
|
236
|
+
/** Extract selected action IDs from selection map */
|
|
237
|
+
private getSelectedIds;
|
|
493
238
|
private sanitizeHtml;
|
|
494
|
-
/**
|
|
495
|
-
* Recursively collect ALL missing prerequisites at all dependency levels
|
|
496
|
-
*
|
|
497
|
-
* This prevents cascading prerequisite dialogs by finding the complete
|
|
498
|
-
* dependency chain upfront.
|
|
499
|
-
*
|
|
500
|
-
* **Example:**
|
|
501
|
-
* - Action 4 requires Action 3
|
|
502
|
-
* - Action 3 requires Action 2
|
|
503
|
-
* - Action 2 requires Action 1
|
|
504
|
-
*
|
|
505
|
-
* Instead of showing 3 separate dialogs, this returns: [Action 3, Action 2, Action 1]
|
|
506
|
-
*
|
|
507
|
-
* @param action - Starting action to check
|
|
508
|
-
* @param currentSelection - Current selection map
|
|
509
|
-
* @param allActions - All available actions
|
|
510
|
-
* @returns Complete set of missing prerequisites across all levels
|
|
511
|
-
*/
|
|
239
|
+
/** Recursively collect ALL missing prerequisites at all dependency levels */
|
|
512
240
|
private getAllMissingPrerequisitesRecursive;
|
|
513
241
|
private showPrerequisiteDialog;
|
|
514
242
|
private showDependencyDialog;
|
|
@@ -520,66 +248,21 @@ declare class ActionPermissionLogicService {
|
|
|
520
248
|
private findRequiredActionIds;
|
|
521
249
|
private buildSimpleMessage;
|
|
522
250
|
private formatLogicNode;
|
|
523
|
-
/**
|
|
524
|
-
* Build clean text-based logic tree for tooltips
|
|
525
|
-
*/
|
|
251
|
+
/** Build clean text-based logic tree for tooltips */
|
|
526
252
|
private buildTooltipLogicTree;
|
|
527
253
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ActionPermissionLogicService, never>;
|
|
528
254
|
static ɵprov: _angular_core.ɵɵInjectableDeclaration<ActionPermissionLogicService>;
|
|
529
255
|
}
|
|
530
256
|
|
|
531
|
-
/**
|
|
532
|
-
* Consolidated Permission API Service
|
|
533
|
-
* Handles all permission-related operations in one service
|
|
534
|
-
* Supports:
|
|
535
|
-
* - User → Action (direct permissions)
|
|
536
|
-
* - User → Role (role assignments)
|
|
537
|
-
* - Role → Action (role permissions)
|
|
538
|
-
* - Company → Action (company whitelisting)
|
|
539
|
-
*
|
|
540
|
-
* Endpoint: POST /permissions/*
|
|
541
|
-
*/
|
|
542
257
|
declare class PermissionApiService extends BaseApiService {
|
|
543
258
|
constructor();
|
|
544
|
-
/**
|
|
545
|
-
* Assign/remove actions directly to/from user
|
|
546
|
-
* POST /permissions/user-actions/assign
|
|
547
|
-
*/
|
|
548
259
|
assignUserActions(data: IAssignUserActionsDto): Observable<ISingleResponse<IPermissionOperationResultDto>>;
|
|
549
|
-
/**
|
|
550
|
-
* Get user's direct action permissions
|
|
551
|
-
* POST /iam/permissions/get-user-actions
|
|
552
|
-
*/
|
|
553
260
|
getUserActions(userId: string, query?: IGetUserActionsDto): Observable<ISingleResponse<IUserActionResponseDto[]>>;
|
|
554
|
-
/**
|
|
555
|
-
* Assign/remove roles to/from user
|
|
556
|
-
* POST /permissions/user-roles/assign
|
|
557
|
-
*/
|
|
558
261
|
assignUserRoles(data: IAssignUserRolesDto): Observable<ISingleResponse<IPermissionOperationResultDto>>;
|
|
559
|
-
/**
|
|
560
|
-
* Get user's role assignments
|
|
561
|
-
* POST /iam/permissions/get-user-roles
|
|
562
|
-
*/
|
|
563
262
|
getUserRoles(userId: string, query?: IGetUserRolesDto): Observable<ISingleResponse<IUserRoleResponseDto[]>>;
|
|
564
|
-
/**
|
|
565
|
-
* Assign/remove actions to/from role
|
|
566
|
-
* POST /permissions/role-actions/assign
|
|
567
|
-
*/
|
|
568
263
|
assignRoleActions(data: IAssignRoleActionsDto): Observable<ISingleResponse<IPermissionOperationResultDto>>;
|
|
569
|
-
|
|
570
|
-
* Get role's action permissions
|
|
571
|
-
* POST /iam/permissions/get-role-actions
|
|
572
|
-
*/
|
|
573
|
-
getRoleActions(roleId: string, query?: IGetRoleActionsDto): Observable<ISingleResponse<IRoleActionResponseDto[]>>;
|
|
574
|
-
/**
|
|
575
|
-
* Assign/remove actions to/from company (whitelisting)
|
|
576
|
-
* POST /permissions/company-actions/assign
|
|
577
|
-
*/
|
|
264
|
+
getRoleActions(roleId: string): Observable<ISingleResponse<IRoleActionResponseDto[]>>;
|
|
578
265
|
assignCompanyActions(data: IAssignCompanyActionsDto): Observable<ISingleResponse<IPermissionOperationResultDto>>;
|
|
579
|
-
/**
|
|
580
|
-
* Get company's whitelisted actions
|
|
581
|
-
* POST /iam/permissions/get-company-actions
|
|
582
|
-
*/
|
|
583
266
|
getCompanyActions(companyId: string): Observable<ISingleResponse<ICompanyActionResponseDto[]>>;
|
|
584
267
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<PermissionApiService, never>;
|
|
585
268
|
static ɵprov: _angular_core.ɵɵInjectableDeclaration<PermissionApiService>;
|
|
@@ -607,45 +290,14 @@ declare class MyPermissionsApiService {
|
|
|
607
290
|
static ɵprov: _angular_core.ɵɵInjectableDeclaration<MyPermissionsApiService>;
|
|
608
291
|
}
|
|
609
292
|
|
|
610
|
-
/**
|
|
611
|
-
* Permission State Service
|
|
612
|
-
* Manages user permissions state and provides permission checking methods
|
|
613
|
-
*
|
|
614
|
-
* Uses shared PermissionValidatorService for centralized permission checking.
|
|
615
|
-
*
|
|
616
|
-
* @example
|
|
617
|
-
* ```typescript
|
|
618
|
-
* // In component
|
|
619
|
-
* readonly permissionState = inject(PermissionStateService);
|
|
620
|
-
*
|
|
621
|
-
* ngOnInit() {
|
|
622
|
-
* this.permissionState.loadPermissions();
|
|
623
|
-
* }
|
|
624
|
-
*
|
|
625
|
-
* // Check permission
|
|
626
|
-
* if (this.permissionState.hasAction('user.create')) {
|
|
627
|
-
* // Show create button
|
|
628
|
-
* }
|
|
629
|
-
* ```
|
|
630
|
-
*/
|
|
631
293
|
declare class PermissionStateService {
|
|
632
294
|
private readonly permissionApi;
|
|
633
295
|
private readonly permissionValidator;
|
|
634
296
|
private readonly _permissions;
|
|
635
|
-
readonly permissions: Signal<IMyPermissionsResponseDto | null>;
|
|
297
|
+
readonly permissions: _angular_core.Signal<IMyPermissionsResponseDto | null>;
|
|
636
298
|
private readonly _isLoading;
|
|
637
|
-
readonly isLoading: Signal<boolean>;
|
|
638
|
-
/**
|
|
639
|
-
* Load current user's permissions from API
|
|
640
|
-
* Call this on app initialization or after login
|
|
641
|
-
* Returns Observable for reactive composition
|
|
642
|
-
*/
|
|
299
|
+
readonly isLoading: _angular_core.Signal<boolean>;
|
|
643
300
|
loadPermissions(dto?: IGetMyPermissionsDto): Observable<void>;
|
|
644
|
-
/**
|
|
645
|
-
* Check if permissions are loaded
|
|
646
|
-
*
|
|
647
|
-
* @returns true if permissions are loaded
|
|
648
|
-
*/
|
|
649
301
|
isLoaded(): boolean;
|
|
650
302
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<PermissionStateService, never>;
|
|
651
303
|
static ɵprov: _angular_core.ɵɵInjectableDeclaration<PermissionStateService>;
|
|
@@ -667,10 +319,6 @@ declare class LogicBuilderComponent {
|
|
|
667
319
|
name: string;
|
|
668
320
|
}[]>;
|
|
669
321
|
readonly logicChange: _angular_core.OutputEmitterRef<ILogicNode | null>;
|
|
670
|
-
readonly availableActions: _angular_core.Signal<{
|
|
671
|
-
id: string;
|
|
672
|
-
name: string;
|
|
673
|
-
}[]>;
|
|
674
322
|
/** Internal builder tree state (private writable + public readonly pattern) */
|
|
675
323
|
private readonly _builderTree;
|
|
676
324
|
readonly builderLogic: _angular_core.Signal<IBuilderNode | null>;
|
|
@@ -681,7 +329,10 @@ declare class LogicBuilderComponent {
|
|
|
681
329
|
addChildNode(parentId: string, type: 'group' | 'action'): void;
|
|
682
330
|
removeNode(nodeId: string): void;
|
|
683
331
|
updateActionId(nodeId: string, actionId: string): void;
|
|
684
|
-
|
|
332
|
+
/** Updates a node in the tree and emits the change */
|
|
333
|
+
private updateNode;
|
|
334
|
+
/** Sets the tree and emits the change */
|
|
335
|
+
private updateTreeAndEmit;
|
|
685
336
|
private updateNodeInTree;
|
|
686
337
|
private removeNodeFromTree;
|
|
687
338
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<LogicBuilderComponent, never>;
|
|
@@ -775,25 +426,16 @@ declare class RoleActionSelectorComponent {
|
|
|
775
426
|
* Handle action toggle with dependency management
|
|
776
427
|
*/
|
|
777
428
|
onActionToggle(action: IAction, newValue: boolean): void;
|
|
778
|
-
/**
|
|
779
|
-
* Toggle all actions
|
|
780
|
-
*/
|
|
781
429
|
toggleAll(): void;
|
|
782
|
-
/**
|
|
783
|
-
* Select all actions
|
|
784
|
-
*/
|
|
785
430
|
selectAll(): void;
|
|
786
|
-
/**
|
|
787
|
-
* Deselect all actions
|
|
788
|
-
*/
|
|
789
431
|
deselectAll(): void;
|
|
432
|
+
private setAllSelection;
|
|
790
433
|
/**
|
|
791
434
|
* Save changes to backend
|
|
792
435
|
*/
|
|
793
436
|
saveChanges(): Promise<void>;
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
*/
|
|
437
|
+
private applySelection;
|
|
438
|
+
private buildPayloadItems;
|
|
797
439
|
private resetState;
|
|
798
440
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<RoleActionSelectorComponent, never>;
|
|
799
441
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<RoleActionSelectorComponent, "flusys-role-action-selector", never, {}, {}, never, never, true, never>;
|
|
@@ -887,18 +529,10 @@ declare class CompanyActionSelectorComponent {
|
|
|
887
529
|
* Handle action checkbox toggle
|
|
888
530
|
*/
|
|
889
531
|
onActionToggle(action: IAction, newValue: boolean): void;
|
|
890
|
-
/**
|
|
891
|
-
* Toggle all actions
|
|
892
|
-
*/
|
|
893
532
|
toggleAll(): void;
|
|
894
|
-
/**
|
|
895
|
-
* Select all actions
|
|
896
|
-
*/
|
|
897
533
|
selectAll(): void;
|
|
898
|
-
/**
|
|
899
|
-
* Deselect all actions
|
|
900
|
-
*/
|
|
901
534
|
deselectAll(): void;
|
|
535
|
+
private setAllSelection;
|
|
902
536
|
/**
|
|
903
537
|
* Save changes to backend
|
|
904
538
|
*/
|
|
@@ -908,10 +542,9 @@ declare class CompanyActionSelectorComponent {
|
|
|
908
542
|
* Shows confirmation dialog with auto-fix option
|
|
909
543
|
*/
|
|
910
544
|
private handleBackendPrerequisiteErrors;
|
|
911
|
-
/**
|
|
912
|
-
* Reset component state
|
|
913
|
-
*/
|
|
914
545
|
private resetState;
|
|
546
|
+
private buildSelectionMap;
|
|
547
|
+
private buildPayloadItems;
|
|
915
548
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CompanyActionSelectorComponent, never>;
|
|
916
549
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CompanyActionSelectorComponent, "flusys-company-action-selector", never, {}, {}, never, never, true, never>;
|
|
917
550
|
}
|
|
@@ -957,8 +590,6 @@ declare class UserRoleSelectorComponent {
|
|
|
957
590
|
private readonly roleApi;
|
|
958
591
|
private readonly permissionApi;
|
|
959
592
|
private readonly messageService;
|
|
960
|
-
private readonly destroyRef;
|
|
961
|
-
private loadDataAbortController;
|
|
962
593
|
readonly selectedUserId: _angular_core.WritableSignal<string | null>;
|
|
963
594
|
readonly selectedBranchId: _angular_core.WritableSignal<string | undefined>;
|
|
964
595
|
readonly branches: _angular_core.WritableSignal<IBranch[]>;
|
|
@@ -1006,6 +637,10 @@ declare class UserRoleSelectorComponent {
|
|
|
1006
637
|
* Deselect all roles
|
|
1007
638
|
*/
|
|
1008
639
|
deselectAll(): void;
|
|
640
|
+
/**
|
|
641
|
+
* Set all role selections to a given value
|
|
642
|
+
*/
|
|
643
|
+
private setAllSelections;
|
|
1009
644
|
/**
|
|
1010
645
|
* Save changes to backend
|
|
1011
646
|
*/
|
|
@@ -1061,8 +696,6 @@ declare class UserActionSelectorComponent {
|
|
|
1061
696
|
private readonly permissionApi;
|
|
1062
697
|
private readonly permissionLogic;
|
|
1063
698
|
private readonly messageService;
|
|
1064
|
-
private readonly destroyRef;
|
|
1065
|
-
private loadDataAbortController;
|
|
1066
699
|
readonly selectedUserId: _angular_core.WritableSignal<string | null>;
|
|
1067
700
|
readonly selectedBranchId: _angular_core.WritableSignal<string | undefined>;
|
|
1068
701
|
readonly branches: _angular_core.WritableSignal<IBranch[]>;
|
|
@@ -1076,6 +709,7 @@ declare class UserActionSelectorComponent {
|
|
|
1076
709
|
readonly selectionMap: _angular_core.Signal<Record<string, boolean>>;
|
|
1077
710
|
private readonly _initialSelection;
|
|
1078
711
|
private readonly initialSelection;
|
|
712
|
+
private readonly isCompanyFeatureActive;
|
|
1079
713
|
readonly showBranchSelector: _angular_core.Signal<boolean>;
|
|
1080
714
|
readonly filteredBranches: _angular_core.Signal<IBranch[]>;
|
|
1081
715
|
readonly treeNodes: _angular_core.Signal<primeng_api.TreeNode<IAction>[]>;
|
|
@@ -1107,26 +741,14 @@ declare class UserActionSelectorComponent {
|
|
|
1107
741
|
* Handle action toggle with dependency management
|
|
1108
742
|
*/
|
|
1109
743
|
onActionToggle(action: IAction, newValue: boolean): void;
|
|
1110
|
-
/**
|
|
1111
|
-
* Toggle all actions
|
|
1112
|
-
*/
|
|
1113
744
|
toggleAll(): void;
|
|
1114
|
-
/**
|
|
1115
|
-
* Select all actions
|
|
1116
|
-
*/
|
|
1117
745
|
selectAll(): void;
|
|
1118
|
-
/**
|
|
1119
|
-
* Deselect all actions
|
|
1120
|
-
*/
|
|
1121
746
|
deselectAll(): void;
|
|
1122
|
-
|
|
1123
|
-
* Save changes to backend
|
|
1124
|
-
*/
|
|
747
|
+
private setAllActions;
|
|
1125
748
|
saveChanges(): Promise<void>;
|
|
1126
|
-
/**
|
|
1127
|
-
* Reset component state
|
|
1128
|
-
*/
|
|
1129
749
|
private resetState;
|
|
750
|
+
private buildSelectionMap;
|
|
751
|
+
private buildPermissionItems;
|
|
1130
752
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<UserActionSelectorComponent, never>;
|
|
1131
753
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<UserActionSelectorComponent, "flusys-user-action-selector", never, {}, {}, never, never, true, never>;
|
|
1132
754
|
}
|
|
@@ -1155,38 +777,18 @@ declare class ProfilePermissionProviderAdapter implements IProfilePermissionProv
|
|
|
1155
777
|
static ɵprov: _angular_core.ɵɵInjectableDeclaration<ProfilePermissionProviderAdapter>;
|
|
1156
778
|
}
|
|
1157
779
|
|
|
1158
|
-
/**
|
|
1159
|
-
* Provide IAM Provider Adapters
|
|
1160
|
-
*
|
|
1161
|
-
* Registers IAM implementations for provider interfaces from ng-shared.
|
|
1162
|
-
* This allows ng-auth profile page to display permissions without direct dependencies.
|
|
1163
|
-
*
|
|
1164
|
-
* @example
|
|
1165
|
-
* // In app.config.ts
|
|
1166
|
-
* import { provideIamProviders } from '@flusys/ng-iam';
|
|
1167
|
-
*
|
|
1168
|
-
* export const appConfig: ApplicationConfig = {
|
|
1169
|
-
* providers: [
|
|
1170
|
-
* ...provideIamProviders(),
|
|
1171
|
-
* // ... other providers
|
|
1172
|
-
* ]
|
|
1173
|
-
* };
|
|
1174
|
-
*
|
|
1175
|
-
* @returns Array of Angular providers
|
|
1176
|
-
*/
|
|
780
|
+
/** Registers IAM provider adapters for ng-shared interfaces */
|
|
1177
781
|
declare function provideIamProviders(): Provider[];
|
|
1178
782
|
|
|
1179
783
|
/**
|
|
1180
784
|
* IAM Routes Configuration
|
|
1181
785
|
*
|
|
1182
|
-
* Identity and Access Management routing
|
|
1183
|
-
* - Actions: Permission actions
|
|
786
|
+
* Identity and Access Management routing with permission guards.
|
|
787
|
+
* - Actions: Permission actions management
|
|
1184
788
|
* - Roles: Role management (conditional on RBAC/FULL mode)
|
|
1185
|
-
* - Permissions: User permission assignments
|
|
1186
|
-
*
|
|
1187
|
-
* All routes are protected by permission guards to prevent direct URL access.
|
|
789
|
+
* - Permissions: User permission assignments
|
|
1188
790
|
*/
|
|
1189
791
|
declare const IAM_ROUTES: Routes;
|
|
1190
792
|
|
|
1191
793
|
export { ActionApiService, ActionPermissionLogicService, ActionType, CompanyActionSelectorComponent, IAM_ROUTES, LogicBuilderComponent, MAX_DROPDOWN_ITEMS, MyPermissionsApiService, PermissionApiService, PermissionStateService, ProfilePermissionProviderAdapter, RoleActionSelectorComponent, RoleApiService, UserActionSelectorComponent, UserRoleSelectorComponent, provideIamProviders };
|
|
1192
|
-
export type { IAction, IActionTreeDto, IAssignCompanyActionsDto, IAssignRoleActionsDto, IAssignUserActionsDto, IAssignUserRolesDto, IBranch, ICompany, ICompanyActionResponseDto, ICreateActionDto, ICreateRoleDto, IGetMyPermissionsDto, IGetRoleActionsDto, IGetUserActionsDto, IGetUserRolesDto,
|
|
794
|
+
export type { IAction, IActionTreeDto, IAssignCompanyActionsDto, IAssignRoleActionsDto, IAssignUserActionsDto, IAssignUserRolesDto, IBranch, ICompany, ICompanyActionResponseDto, ICreateActionDto, ICreateRoleDto, IGetMyPermissionsDto, IGetRoleActionsDto, IGetUserActionsDto, IGetUserRolesDto, IMyPermissionsResponseDto, IPermissionItemDto, IPermissionOperationResultDto, IPrerequisiteActionDto, IPrerequisiteValidationError, IRole, IRoleActionResponseDto, IRoleQueryDto, IUpdateActionDto, IUpdateRoleDto, IUser, IUserActionResponseDto, IUserRoleResponseDto, PermissionAction };
|