@masterteam/permissions 0.0.1 → 0.0.2
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.
|
@@ -8,6 +8,12 @@ import { ModalRef } from '@masterteam/components/dialog';
|
|
|
8
8
|
import * as rxjs from 'rxjs';
|
|
9
9
|
import { Observable } from 'rxjs';
|
|
10
10
|
import { StateContext } from '@ngxs/store';
|
|
11
|
+
import { CrudStateBase } from '@masterteam/components';
|
|
12
|
+
|
|
13
|
+
interface LoadingStateShape<L extends string = string> {
|
|
14
|
+
loadingActive: L[];
|
|
15
|
+
errors: Partial<Record<L, string>>;
|
|
16
|
+
}
|
|
11
17
|
|
|
12
18
|
interface Role {
|
|
13
19
|
name: string;
|
|
@@ -40,7 +46,7 @@ interface RolesResponse {
|
|
|
40
46
|
locale: string;
|
|
41
47
|
message: string;
|
|
42
48
|
errors: null | string[];
|
|
43
|
-
data:
|
|
49
|
+
data: LevelRoles[];
|
|
44
50
|
cacheSession: string;
|
|
45
51
|
}
|
|
46
52
|
interface PermissionsResponseData {
|
|
@@ -71,6 +77,30 @@ interface UpdatePermissionPayload {
|
|
|
71
77
|
levelId: string;
|
|
72
78
|
permissions: LevelPermission[];
|
|
73
79
|
}
|
|
80
|
+
declare enum PermissionsActionKey {
|
|
81
|
+
LoadRoles = "loadRoles",
|
|
82
|
+
SelectRole = "selectRole",
|
|
83
|
+
SelectGroup = "selectGroup",
|
|
84
|
+
LoadPermissions = "loadPermissions",
|
|
85
|
+
LoadGroupPermissions = "loadGroupPermissions",
|
|
86
|
+
UpdatePermission = "updatePermission",
|
|
87
|
+
UpdateGroupPermission = "updateGroupPermission",
|
|
88
|
+
ToggleAllLevelPermissions = "toggleAllLevelPermissions",
|
|
89
|
+
ToggleAllGroupPermissions = "toggleAllGroupPermissions"
|
|
90
|
+
}
|
|
91
|
+
interface PermissionsStateModel extends LoadingStateShape<PermissionsActionKey> {
|
|
92
|
+
roles: LevelRoles[];
|
|
93
|
+
selectedRoleValue: string | null;
|
|
94
|
+
selectedGroupValue: string | number | null;
|
|
95
|
+
permissions: PermissionLog[];
|
|
96
|
+
groupPermissions: LevelPermission[];
|
|
97
|
+
currentLevelId: string | null;
|
|
98
|
+
moduleType: string;
|
|
99
|
+
moduleId: string | number;
|
|
100
|
+
parentModuleType?: string | null;
|
|
101
|
+
parentModuleId?: string | number | null;
|
|
102
|
+
parentPath?: string;
|
|
103
|
+
}
|
|
74
104
|
declare enum ModuleType {
|
|
75
105
|
LEVEL = "level",
|
|
76
106
|
LOG = "log",
|
|
@@ -145,16 +175,6 @@ declare class LoadRoles {
|
|
|
145
175
|
static readonly type = "[Permissions] Load Roles";
|
|
146
176
|
constructor();
|
|
147
177
|
}
|
|
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
178
|
declare class SelectRole {
|
|
159
179
|
roleValue: string;
|
|
160
180
|
static readonly type = "[Permissions] Select Role";
|
|
@@ -177,21 +197,6 @@ declare class LoadGroupPermissions {
|
|
|
177
197
|
static readonly type = "[Permissions] Load Group Permissions";
|
|
178
198
|
constructor(groupId: number, levelId: string);
|
|
179
199
|
}
|
|
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
200
|
declare class UpdatePermissionLocally {
|
|
196
201
|
roleValue: string;
|
|
197
202
|
levelId: string;
|
|
@@ -221,14 +226,6 @@ declare class UpdateGroupPermission {
|
|
|
221
226
|
static readonly type = "[Permissions] Update Group Permission";
|
|
222
227
|
constructor(groupId: string, permissionLogs: PermissionLog[], levelId: string);
|
|
223
228
|
}
|
|
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);
|
|
231
|
-
}
|
|
232
229
|
declare class ToggleAllLevelPermissions {
|
|
233
230
|
roleValue: string;
|
|
234
231
|
levelId: string;
|
|
@@ -260,18 +257,28 @@ declare class Reset {
|
|
|
260
257
|
|
|
261
258
|
declare class PermissionsFacade {
|
|
262
259
|
private store;
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
260
|
+
readonly roles: _angular_core.Signal<_masterteam_permissions.LevelRoles[]>;
|
|
261
|
+
readonly selectedRoleValue: _angular_core.Signal<string | null>;
|
|
262
|
+
readonly selectedGroupValue: _angular_core.Signal<string | number | null>;
|
|
263
|
+
readonly permissions: _angular_core.Signal<PermissionLog[]>;
|
|
264
|
+
readonly groupPermissions: _angular_core.Signal<_masterteam_permissions.LevelPermission[]>;
|
|
265
|
+
readonly moduleType: _angular_core.Signal<string>;
|
|
266
|
+
readonly moduleId: _angular_core.Signal<string | number>;
|
|
267
|
+
readonly levelId: _angular_core.Signal<string>;
|
|
268
|
+
private readonly loadingActive;
|
|
269
|
+
private readonly errors;
|
|
270
|
+
readonly isLoadingRoles: _angular_core.Signal<boolean>;
|
|
271
|
+
readonly isLoadingPermissions: _angular_core.Signal<boolean>;
|
|
272
|
+
readonly isLoadingGroupPermissions: _angular_core.Signal<boolean>;
|
|
273
|
+
readonly isUpdatingPermission: _angular_core.Signal<boolean>;
|
|
274
|
+
readonly isUpdatingGroupPermission: _angular_core.Signal<boolean>;
|
|
275
|
+
readonly isTogglingLevelPermissions: _angular_core.Signal<boolean>;
|
|
276
|
+
readonly isTogglingGroupPermissions: _angular_core.Signal<boolean>;
|
|
277
|
+
readonly rolesError: _angular_core.Signal<string | null>;
|
|
278
|
+
readonly permissionsError: _angular_core.Signal<string | null>;
|
|
279
|
+
readonly groupPermissionsError: _angular_core.Signal<string | null>;
|
|
280
|
+
readonly updatePermissionError: _angular_core.Signal<string | null>;
|
|
281
|
+
readonly updateGroupPermissionError: _angular_core.Signal<string | null>;
|
|
275
282
|
loadRoles(): Observable<void>;
|
|
276
283
|
selectRole(roleValue: string): Observable<void> | undefined;
|
|
277
284
|
selectGroup(groupId: number): Observable<void> | undefined;
|
|
@@ -289,47 +296,23 @@ declare class PermissionsFacade {
|
|
|
289
296
|
static ɵprov: _angular_core.ɵɵInjectableDeclaration<PermissionsFacade>;
|
|
290
297
|
}
|
|
291
298
|
|
|
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 {
|
|
299
|
+
declare class PermissionsState extends CrudStateBase<LevelRoles, PermissionsStateModel, PermissionsActionKey> {
|
|
310
300
|
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;
|
|
301
|
+
static getRoles(state: PermissionsStateModel): LevelRoles[];
|
|
302
|
+
static getSelectedRoleValue(state: PermissionsStateModel): string | null;
|
|
303
|
+
static getSelectedGroupValue(state: PermissionsStateModel): string | number | null;
|
|
304
|
+
static getPermissions(state: PermissionsStateModel): PermissionLog[];
|
|
305
|
+
static getGroupPermissions(state: PermissionsStateModel): LevelPermission[];
|
|
306
|
+
static getModuleType(state: PermissionsStateModel): string;
|
|
307
|
+
static getModuleId(state: PermissionsStateModel): string | number;
|
|
308
|
+
static getLevelId(state: PermissionsStateModel): string;
|
|
309
|
+
static getLoadingActive(state: PermissionsStateModel): string[];
|
|
310
|
+
static getErrors(state: PermissionsStateModel): Record<string, string | null>;
|
|
311
|
+
loadRoles(ctx: StateContext<PermissionsStateModel>): rxjs.Observable<LevelRoles[]>;
|
|
326
312
|
selectRole(ctx: StateContext<PermissionsStateModel>, action: SelectRole): void;
|
|
327
313
|
selectGroup(ctx: StateContext<PermissionsStateModel>, action: SelectGroup): void;
|
|
328
314
|
loadPermissions(ctx: StateContext<PermissionsStateModel>, action: LoadPermissions): rxjs.Observable<PermissionLog[]>;
|
|
329
315
|
loadGroupPermissions(ctx: StateContext<PermissionsStateModel>, action: LoadGroupPermissions): rxjs.Observable<LevelPermission[]>;
|
|
330
|
-
loadPermissionsSuccess(ctx: StateContext<PermissionsStateModel>, action: LoadPermissionsSuccess): void;
|
|
331
|
-
loadGroupPermissionsSuccess(ctx: StateContext<PermissionsStateModel>, action: LoadGroupPermissionsSuccess): void;
|
|
332
|
-
loadPermissionsFail(ctx: StateContext<PermissionsStateModel>, action: LoadPermissionsFail): void;
|
|
333
316
|
updatePermissionLocally(ctx: StateContext<PermissionsStateModel>, action: UpdatePermissionLocally): void;
|
|
334
317
|
updateGroupPermissionLocally(ctx: StateContext<PermissionsStateModel>, action: UpdateGroupPermissionLocally): void;
|
|
335
318
|
updatePermission(ctx: StateContext<PermissionsStateModel>, action: UpdatePermission): rxjs.Observable<PermissionsResponse>;
|
|
@@ -342,5 +325,5 @@ declare class PermissionsState {
|
|
|
342
325
|
static ɵprov: _angular_core.ɵɵInjectableDeclaration<PermissionsState>;
|
|
343
326
|
}
|
|
344
327
|
|
|
345
|
-
export { LoadGroupPermissions,
|
|
328
|
+
export { LoadGroupPermissions, LoadPermissions, LoadRoles, ModuleType, PermissionsActionKey, PermissionsEditDialog, PermissionsFacade, PermissionsPage, PermissionsState, Reset, SelectGroup, SelectRole, SetModuleInfo, ToggleAllGroupPermissions, ToggleAllLevelPermissions, UpdateGroupPermission, UpdateGroupPermissionLocally, UpdatePermission, UpdatePermissionLocally };
|
|
346
329
|
export type { GroupPermissionsResponse, LevelPermission, LevelRoles, PermissionAction, PermissionLog, PermissionsResponse, PermissionsResponseData, PermissionsStateModel, Role, RolesResponse, UpdatePermissionPayload };
|