@masterteam/permissions 0.0.1 → 0.0.3
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.
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as _masterteam_accessibilities from '@masterteam/accessibilities';
|
|
2
1
|
import * as _angular_core from '@angular/core';
|
|
3
2
|
import { OnInit, OnDestroy } from '@angular/core';
|
|
4
3
|
import * as _masterteam_permissions from '@masterteam/permissions';
|
|
@@ -8,6 +7,12 @@ import { ModalRef } from '@masterteam/components/dialog';
|
|
|
8
7
|
import * as rxjs from 'rxjs';
|
|
9
8
|
import { Observable } from 'rxjs';
|
|
10
9
|
import { StateContext } from '@ngxs/store';
|
|
10
|
+
import { CrudStateBase } from '@masterteam/components';
|
|
11
|
+
|
|
12
|
+
interface LoadingStateShape<L extends string = string> {
|
|
13
|
+
loadingActive: L[];
|
|
14
|
+
errors: Partial<Record<L, string>>;
|
|
15
|
+
}
|
|
11
16
|
|
|
12
17
|
interface Role {
|
|
13
18
|
name: string;
|
|
@@ -31,7 +36,7 @@ interface PermissionLog {
|
|
|
31
36
|
}
|
|
32
37
|
interface LevelPermission {
|
|
33
38
|
levelName: string;
|
|
34
|
-
|
|
39
|
+
modules: PermissionLog[];
|
|
35
40
|
}
|
|
36
41
|
interface RolesResponse {
|
|
37
42
|
endpoint: string;
|
|
@@ -40,11 +45,11 @@ interface RolesResponse {
|
|
|
40
45
|
locale: string;
|
|
41
46
|
message: string;
|
|
42
47
|
errors: null | string[];
|
|
43
|
-
data:
|
|
48
|
+
data: LevelRoles[];
|
|
44
49
|
cacheSession: string;
|
|
45
50
|
}
|
|
46
51
|
interface PermissionsResponseData {
|
|
47
|
-
|
|
52
|
+
modules: PermissionLog[];
|
|
48
53
|
}
|
|
49
54
|
interface PermissionsResponse {
|
|
50
55
|
endpoint: string;
|
|
@@ -71,6 +76,30 @@ interface UpdatePermissionPayload {
|
|
|
71
76
|
levelId: string;
|
|
72
77
|
permissions: LevelPermission[];
|
|
73
78
|
}
|
|
79
|
+
declare enum PermissionsActionKey {
|
|
80
|
+
LoadRoles = "loadRoles",
|
|
81
|
+
SelectRole = "selectRole",
|
|
82
|
+
SelectGroup = "selectGroup",
|
|
83
|
+
LoadPermissions = "loadPermissions",
|
|
84
|
+
LoadGroupPermissions = "loadGroupPermissions",
|
|
85
|
+
UpdatePermission = "updatePermission",
|
|
86
|
+
UpdateGroupPermission = "updateGroupPermission",
|
|
87
|
+
ToggleAllLevelPermissions = "toggleAllLevelPermissions",
|
|
88
|
+
ToggleAllGroupPermissions = "toggleAllGroupPermissions"
|
|
89
|
+
}
|
|
90
|
+
interface PermissionsStateModel extends LoadingStateShape<PermissionsActionKey> {
|
|
91
|
+
roles: LevelRoles[];
|
|
92
|
+
selectedRoleValue: string | null;
|
|
93
|
+
selectedGroupValue: string | number | null;
|
|
94
|
+
permissions: PermissionLog[];
|
|
95
|
+
groupPermissions: LevelPermission[];
|
|
96
|
+
currentLevelId: string | null;
|
|
97
|
+
moduleType: string;
|
|
98
|
+
moduleId: string | number;
|
|
99
|
+
parentModuleType?: string | null;
|
|
100
|
+
parentModuleId?: string | number | null;
|
|
101
|
+
parentPath?: string;
|
|
102
|
+
}
|
|
74
103
|
declare enum ModuleType {
|
|
75
104
|
LEVEL = "level",
|
|
76
105
|
LOG = "log",
|
|
@@ -92,11 +121,10 @@ declare class PermissionsPage implements OnInit, OnDestroy {
|
|
|
92
121
|
selectedGroupValue: _angular_core.Signal<string | number | null>;
|
|
93
122
|
selectedGroup: _angular_core.WritableSignal<string | number | null>;
|
|
94
123
|
permissions: _angular_core.Signal<PermissionLog[]>;
|
|
95
|
-
groupPermissions: _angular_core.Signal<_masterteam_permissions.LevelPermission[]>;
|
|
96
124
|
loading: _angular_core.Signal<boolean>;
|
|
97
125
|
permissionsLoading: _angular_core.Signal<boolean>;
|
|
98
126
|
levelId: _angular_core.Signal<string>;
|
|
99
|
-
groups:
|
|
127
|
+
groups: any;
|
|
100
128
|
allPermissionsToggle: FormControl<boolean | null>;
|
|
101
129
|
readonly groupOrRoleId: _angular_core.Signal<string>;
|
|
102
130
|
readonly selectedTabFromParams: _angular_core.Signal<any>;
|
|
@@ -145,16 +173,6 @@ declare class LoadRoles {
|
|
|
145
173
|
static readonly type = "[Permissions] Load Roles";
|
|
146
174
|
constructor();
|
|
147
175
|
}
|
|
148
|
-
declare class LoadRolesSuccess {
|
|
149
|
-
roles: any[];
|
|
150
|
-
static readonly type = "[Permissions] Load Roles Success";
|
|
151
|
-
constructor(roles: any[]);
|
|
152
|
-
}
|
|
153
|
-
declare class LoadRolesFail {
|
|
154
|
-
error: string;
|
|
155
|
-
static readonly type = "[Permissions] Load Roles Fail";
|
|
156
|
-
constructor(error: string);
|
|
157
|
-
}
|
|
158
176
|
declare class SelectRole {
|
|
159
177
|
roleValue: string;
|
|
160
178
|
static readonly type = "[Permissions] Select Role";
|
|
@@ -177,21 +195,6 @@ declare class LoadGroupPermissions {
|
|
|
177
195
|
static readonly type = "[Permissions] Load Group Permissions";
|
|
178
196
|
constructor(groupId: number, levelId: string);
|
|
179
197
|
}
|
|
180
|
-
declare class LoadPermissionsSuccess {
|
|
181
|
-
permissions: PermissionLog[];
|
|
182
|
-
static readonly type = "[Permissions] Load Permissions Success";
|
|
183
|
-
constructor(permissions: PermissionLog[]);
|
|
184
|
-
}
|
|
185
|
-
declare class LoadGroupPermissionsSuccess {
|
|
186
|
-
permissions: LevelPermission[];
|
|
187
|
-
static readonly type = "[Permissions] Load Group Permissions Success";
|
|
188
|
-
constructor(permissions: LevelPermission[]);
|
|
189
|
-
}
|
|
190
|
-
declare class LoadPermissionsFail {
|
|
191
|
-
error: string;
|
|
192
|
-
static readonly type = "[Permissions] Load Permissions Fail";
|
|
193
|
-
constructor(error: string);
|
|
194
|
-
}
|
|
195
198
|
declare class UpdatePermissionLocally {
|
|
196
199
|
roleValue: string;
|
|
197
200
|
levelId: string;
|
|
@@ -200,14 +203,6 @@ declare class UpdatePermissionLocally {
|
|
|
200
203
|
static readonly type = "[Permissions] Update Permission Locally";
|
|
201
204
|
constructor(roleValue: string, levelId: string, actionId: number, isSelected: boolean);
|
|
202
205
|
}
|
|
203
|
-
declare class UpdateGroupPermissionLocally {
|
|
204
|
-
roleValue: string;
|
|
205
|
-
levelId: string;
|
|
206
|
-
actionId: number;
|
|
207
|
-
isSelected: boolean;
|
|
208
|
-
static readonly type = "[Permissions] Update Group Permission Locally";
|
|
209
|
-
constructor(roleValue: string, levelId: string, actionId: number, isSelected: boolean);
|
|
210
|
-
}
|
|
211
206
|
declare class UpdatePermission {
|
|
212
207
|
roleValue: string;
|
|
213
208
|
levelId: string;
|
|
@@ -216,18 +211,9 @@ declare class UpdatePermission {
|
|
|
216
211
|
}
|
|
217
212
|
declare class UpdateGroupPermission {
|
|
218
213
|
groupId: string;
|
|
219
|
-
permissionLogs: PermissionLog[];
|
|
220
214
|
levelId: string;
|
|
221
215
|
static readonly type = "[Permissions] Update Group Permission";
|
|
222
|
-
constructor(groupId: string,
|
|
223
|
-
}
|
|
224
|
-
declare class UpdatePermissionSuccess {
|
|
225
|
-
static readonly type = "[Permissions] Update Permission Success";
|
|
226
|
-
}
|
|
227
|
-
declare class UpdatePermissionFail {
|
|
228
|
-
error: string;
|
|
229
|
-
static readonly type = "[Permissions] Update Permission Fail";
|
|
230
|
-
constructor(error: string);
|
|
216
|
+
constructor(groupId: string, levelId: string);
|
|
231
217
|
}
|
|
232
218
|
declare class ToggleAllLevelPermissions {
|
|
233
219
|
roleValue: string;
|
|
@@ -260,27 +246,36 @@ declare class Reset {
|
|
|
260
246
|
|
|
261
247
|
declare class PermissionsFacade {
|
|
262
248
|
private store;
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
249
|
+
readonly roles: _angular_core.Signal<_masterteam_permissions.LevelRoles[]>;
|
|
250
|
+
readonly selectedRoleValue: _angular_core.Signal<string | null>;
|
|
251
|
+
readonly selectedGroupValue: _angular_core.Signal<string | number | null>;
|
|
252
|
+
readonly permissions: _angular_core.Signal<_masterteam_permissions.PermissionLog[]>;
|
|
253
|
+
readonly groupPermissions: _angular_core.Signal<_masterteam_permissions.LevelPermission[]>;
|
|
254
|
+
readonly moduleType: _angular_core.Signal<string>;
|
|
255
|
+
readonly moduleId: _angular_core.Signal<string | number>;
|
|
256
|
+
readonly levelId: _angular_core.Signal<string>;
|
|
257
|
+
private readonly loadingActive;
|
|
258
|
+
private readonly errors;
|
|
259
|
+
readonly isLoadingRoles: _angular_core.Signal<boolean>;
|
|
260
|
+
readonly isLoadingPermissions: _angular_core.Signal<boolean>;
|
|
261
|
+
readonly isLoadingGroupPermissions: _angular_core.Signal<boolean>;
|
|
262
|
+
readonly isUpdatingPermission: _angular_core.Signal<boolean>;
|
|
263
|
+
readonly isUpdatingGroupPermission: _angular_core.Signal<boolean>;
|
|
264
|
+
readonly isTogglingLevelPermissions: _angular_core.Signal<boolean>;
|
|
265
|
+
readonly isTogglingGroupPermissions: _angular_core.Signal<boolean>;
|
|
266
|
+
readonly rolesError: _angular_core.Signal<string | null>;
|
|
267
|
+
readonly permissionsError: _angular_core.Signal<string | null>;
|
|
268
|
+
readonly groupPermissionsError: _angular_core.Signal<string | null>;
|
|
269
|
+
readonly updatePermissionError: _angular_core.Signal<string | null>;
|
|
270
|
+
readonly updateGroupPermissionError: _angular_core.Signal<string | null>;
|
|
275
271
|
loadRoles(): Observable<void>;
|
|
276
272
|
selectRole(roleValue: string): Observable<void> | undefined;
|
|
277
273
|
selectGroup(groupId: number): Observable<void> | undefined;
|
|
278
274
|
loadPermissions(roleValue: string, levelId: string): Observable<void>;
|
|
279
275
|
loadGroupPermissions(groupId: number, levelId: string): Observable<void>;
|
|
280
276
|
updatePermissionLocally(roleValue: string, levelId: string, actionId: number, isSelected: boolean): Observable<void>;
|
|
281
|
-
updateGroupPermissionLocally(roleValue: string, levelId: string, actionId: number, isSelected: boolean): Observable<void>;
|
|
282
277
|
updatePermission(roleValue: string, levelId: string): Observable<void>;
|
|
283
|
-
updateGroupPermission(groupId: string,
|
|
278
|
+
updateGroupPermission(groupId: string, levelId: string): Observable<void>;
|
|
284
279
|
toggleAllLevelPermissions(roleValue: string, levelId: string, levelName: string, enabled: boolean): Observable<void>;
|
|
285
280
|
toggleAllGroupPermissions(levelId: string, groupId: string, enabled: boolean): Observable<void>;
|
|
286
281
|
setModuleInfo(moduleType: string, moduleId: string | number, parentModuleType?: string, parentModuleId?: string | number, parentPath?: string): Observable<unknown>;
|
|
@@ -289,49 +284,24 @@ declare class PermissionsFacade {
|
|
|
289
284
|
static ɵprov: _angular_core.ɵɵInjectableDeclaration<PermissionsFacade>;
|
|
290
285
|
}
|
|
291
286
|
|
|
292
|
-
|
|
293
|
-
roles: LevelRoles[];
|
|
294
|
-
selectedRoleValue: string | null;
|
|
295
|
-
selectedGroupValue: string | number | null;
|
|
296
|
-
permissions: PermissionLog[];
|
|
297
|
-
groupPermissions: LevelPermission[];
|
|
298
|
-
currentLevelId: string | null;
|
|
299
|
-
loading: boolean;
|
|
300
|
-
permissionsLoading: boolean;
|
|
301
|
-
addPermissionsLoading: boolean;
|
|
302
|
-
error: string | null;
|
|
303
|
-
moduleType: string;
|
|
304
|
-
moduleId: string | number;
|
|
305
|
-
parentModuleType?: string | null;
|
|
306
|
-
parentModuleId?: string | number | null;
|
|
307
|
-
parentPath?: string;
|
|
308
|
-
}
|
|
309
|
-
declare class PermissionsState {
|
|
287
|
+
declare class PermissionsState extends CrudStateBase<LevelRoles, PermissionsStateModel, PermissionsActionKey> {
|
|
310
288
|
private http;
|
|
311
|
-
static
|
|
312
|
-
static
|
|
313
|
-
static
|
|
314
|
-
static
|
|
315
|
-
static
|
|
316
|
-
static
|
|
317
|
-
static
|
|
318
|
-
static
|
|
319
|
-
static
|
|
320
|
-
static
|
|
321
|
-
|
|
322
|
-
static error(state: PermissionsStateModel): string | null;
|
|
323
|
-
loadRoles(ctx: StateContext<PermissionsStateModel>): rxjs.Observable<_masterteam_permissions.Role[]>;
|
|
324
|
-
loadRolesSuccess(ctx: StateContext<PermissionsStateModel>, action: LoadRolesSuccess): void;
|
|
325
|
-
loadRolesFail(ctx: StateContext<PermissionsStateModel>, action: LoadRolesFail): void;
|
|
289
|
+
static getRoles(state: PermissionsStateModel): LevelRoles[];
|
|
290
|
+
static getSelectedRoleValue(state: PermissionsStateModel): string | null;
|
|
291
|
+
static getSelectedGroupValue(state: PermissionsStateModel): string | number | null;
|
|
292
|
+
static getPermissions(state: PermissionsStateModel): PermissionLog[];
|
|
293
|
+
static getGroupPermissions(state: PermissionsStateModel): LevelPermission[];
|
|
294
|
+
static getModuleType(state: PermissionsStateModel): string;
|
|
295
|
+
static getModuleId(state: PermissionsStateModel): string | number;
|
|
296
|
+
static getLevelId(state: PermissionsStateModel): string;
|
|
297
|
+
static getLoadingActive(state: PermissionsStateModel): string[];
|
|
298
|
+
static getErrors(state: PermissionsStateModel): Record<string, string | null>;
|
|
299
|
+
loadRoles(ctx: StateContext<PermissionsStateModel>): rxjs.Observable<any>;
|
|
326
300
|
selectRole(ctx: StateContext<PermissionsStateModel>, action: SelectRole): void;
|
|
327
301
|
selectGroup(ctx: StateContext<PermissionsStateModel>, action: SelectGroup): void;
|
|
328
302
|
loadPermissions(ctx: StateContext<PermissionsStateModel>, action: LoadPermissions): rxjs.Observable<PermissionLog[]>;
|
|
329
|
-
loadGroupPermissions(ctx: StateContext<PermissionsStateModel>, action: LoadGroupPermissions): rxjs.Observable<
|
|
330
|
-
loadPermissionsSuccess(ctx: StateContext<PermissionsStateModel>, action: LoadPermissionsSuccess): void;
|
|
331
|
-
loadGroupPermissionsSuccess(ctx: StateContext<PermissionsStateModel>, action: LoadGroupPermissionsSuccess): void;
|
|
332
|
-
loadPermissionsFail(ctx: StateContext<PermissionsStateModel>, action: LoadPermissionsFail): void;
|
|
303
|
+
loadGroupPermissions(ctx: StateContext<PermissionsStateModel>, action: LoadGroupPermissions): rxjs.Observable<any>;
|
|
333
304
|
updatePermissionLocally(ctx: StateContext<PermissionsStateModel>, action: UpdatePermissionLocally): void;
|
|
334
|
-
updateGroupPermissionLocally(ctx: StateContext<PermissionsStateModel>, action: UpdateGroupPermissionLocally): void;
|
|
335
305
|
updatePermission(ctx: StateContext<PermissionsStateModel>, action: UpdatePermission): rxjs.Observable<PermissionsResponse>;
|
|
336
306
|
updateGroupPermission(ctx: StateContext<PermissionsStateModel>, action: UpdateGroupPermission): rxjs.Observable<PermissionsResponse>;
|
|
337
307
|
toggleAllLevelPermissions(ctx: StateContext<PermissionsStateModel>, action: ToggleAllLevelPermissions): rxjs.Observable<PermissionsResponse>;
|
|
@@ -342,5 +312,5 @@ declare class PermissionsState {
|
|
|
342
312
|
static ɵprov: _angular_core.ɵɵInjectableDeclaration<PermissionsState>;
|
|
343
313
|
}
|
|
344
314
|
|
|
345
|
-
export { LoadGroupPermissions,
|
|
315
|
+
export { LoadGroupPermissions, LoadPermissions, LoadRoles, ModuleType, PermissionsActionKey, PermissionsEditDialog, PermissionsFacade, PermissionsPage, PermissionsState, Reset, SelectGroup, SelectRole, SetModuleInfo, ToggleAllGroupPermissions, ToggleAllLevelPermissions, UpdateGroupPermission, UpdatePermission, UpdatePermissionLocally };
|
|
346
316
|
export type { GroupPermissionsResponse, LevelPermission, LevelRoles, PermissionAction, PermissionLog, PermissionsResponse, PermissionsResponseData, PermissionsStateModel, Role, RolesResponse, UpdatePermissionPayload };
|