@webitel/ui-sdk 24.12.95 → 24.12.96
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/CHANGELOG.md +30 -0
- package/dist/ui-sdk.css +1 -1
- package/dist/ui-sdk.js +2120 -2154
- package/dist/ui-sdk.umd.cjs +16 -16
- package/package.json +14 -8
- package/src/api/defaults/getDefaultInstance/getDefaultInstance.js +5 -2
- package/src/api/defaults/index.js +1 -1
- package/src/components/wt-dual-panel/wt-dual-panel.vue +1 -2
- package/src/components/wt-icon-action/iconMappings.js +1 -1
- package/src/composables/useAccessControl/v2/createUserAccessControl.ts +66 -0
- package/src/composables/useAccessControl/v2/types/CreateUserAccessControl.d.ts +21 -0
- package/src/enums/CrudAction/CrudAction.js +6 -0
- package/src/enums/CrudAction/CrudAction.ts +8 -0
- package/src/enums/WtObject/WtObject.js +51 -1
- package/src/enums/WtObject/WtObject.ts +51 -1
- package/src/enums/index.js +6 -19
- package/src/enums/index.ts +33 -0
- package/src/locale/en/en.js +1 -1
- package/src/locale/ru/ru.js +1 -1
- package/src/locale/ua/ua.js +1 -1
- package/src/modules/Userinfo/api/userinfo.js +21 -34
- package/src/modules/Userinfo/store/UserinfoStoreModule.js +1 -1
- package/src/modules/Userinfo/v2/api/UserinfoAPI.ts +62 -0
- package/src/modules/Userinfo/v2/enums/GlobalActions/GlobalActions.ts +36 -0
- package/src/modules/Userinfo/v2/enums/ScopeClass/ScopeClass.ts +47 -0
- package/src/modules/Userinfo/v2/enums/index.ts +7 -0
- package/src/modules/Userinfo/v2/index.ts +0 -0
- package/src/modules/Userinfo/v2/mappings/mappings.ts +161 -0
- package/src/modules/Userinfo/v2/scripts/utils.ts +123 -0
- package/src/modules/Userinfo/v2/stores/__tests__/accessStore.spec.ts +136 -0
- package/src/modules/Userinfo/v2/stores/accessStore.ts +131 -0
- package/src/modules/Userinfo/v2/stores/userinfoStore.ts +56 -0
- package/src/modules/Userinfo/v2/types/UserAccess.d.ts +118 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { NavigationGuard } from 'vue-router';
|
|
2
|
+
|
|
3
|
+
import type {
|
|
4
|
+
AdminSections,
|
|
5
|
+
AuditorSections,
|
|
6
|
+
CrmSections,
|
|
7
|
+
CrudAction,
|
|
8
|
+
SupervisorSections,
|
|
9
|
+
WtApplication,
|
|
10
|
+
WtObject,
|
|
11
|
+
} from '../../../../enums';
|
|
12
|
+
import type {
|
|
13
|
+
CrudGlobalAction,
|
|
14
|
+
ScopeClass,
|
|
15
|
+
SpecialGlobalAction,
|
|
16
|
+
} from '../enums';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @description
|
|
20
|
+
* Represents union of all Webitel web client applications/sections
|
|
21
|
+
* */
|
|
22
|
+
export type UiSection =
|
|
23
|
+
| AdminSections
|
|
24
|
+
| AuditorSections
|
|
25
|
+
| SupervisorSections
|
|
26
|
+
| CrmSections;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @internal
|
|
30
|
+
* @description Received from backend
|
|
31
|
+
* */
|
|
32
|
+
export type GlobalAction = CrudGlobalAction | SpecialGlobalAction;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @internal
|
|
36
|
+
* */
|
|
37
|
+
export interface GlobalAccessApiResponseItem {
|
|
38
|
+
id: GlobalAction;
|
|
39
|
+
name: string;
|
|
40
|
+
usage: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* @internal
|
|
45
|
+
* */
|
|
46
|
+
export interface ScopeAccessApiResponseItem {
|
|
47
|
+
class: ScopeClass;
|
|
48
|
+
access: string;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* @internal
|
|
53
|
+
* @description
|
|
54
|
+
* Represents admin->permissions->roles->access.
|
|
55
|
+
* */
|
|
56
|
+
export type VisibilityAccess = unknown;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* @internal
|
|
60
|
+
* @description
|
|
61
|
+
* Represents raw access data, received from backend.
|
|
62
|
+
* */
|
|
63
|
+
export interface CreateUserAccessStoreRawAccess {
|
|
64
|
+
permissions: GlobalAccessApiResponseItem[];
|
|
65
|
+
scope: ScopeAccessApiResponseItem[];
|
|
66
|
+
access: VisibilityAccess;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* @internal
|
|
71
|
+
*/
|
|
72
|
+
export interface CreateUserAccessStoreConfig {
|
|
73
|
+
/**
|
|
74
|
+
* @default 'userinfo'
|
|
75
|
+
* */
|
|
76
|
+
namespace?: string;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* @description
|
|
81
|
+
* Map is used for quick access to user permissions
|
|
82
|
+
* */
|
|
83
|
+
export type GlobalActionAccessMap = Map<
|
|
84
|
+
CrudAction | SpecialGlobalAction,
|
|
85
|
+
boolean
|
|
86
|
+
>;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* @description
|
|
90
|
+
* Map is used for quick access to user permissions
|
|
91
|
+
* */
|
|
92
|
+
export type ScopeAccessMap = Map<WtObject, Map<CrudAction, boolean>>;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* @description
|
|
96
|
+
* Map is used for quick access to user permissions
|
|
97
|
+
* */
|
|
98
|
+
export type AppVisibilityMap = Map<WtApplication, boolean>;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* @description
|
|
102
|
+
* Map is used for quick access to user permissions
|
|
103
|
+
* */
|
|
104
|
+
export type SectionVisibilityMap = Map<UiSection, boolean>;
|
|
105
|
+
|
|
106
|
+
export interface UserAccessStore {
|
|
107
|
+
initialize: (CreateUserAccessStoreRawAccess) => void;
|
|
108
|
+
|
|
109
|
+
hasReadAccess: (object?: WtObject) => boolean;
|
|
110
|
+
hasCreateAccess: (object?: WtObject) => boolean;
|
|
111
|
+
hasUpdateAccess: (object?: WtObject) => boolean;
|
|
112
|
+
hasDeleteAccess: (object?: WtObject) => boolean;
|
|
113
|
+
|
|
114
|
+
routeAccessGuard: NavigationGuard;
|
|
115
|
+
|
|
116
|
+
// hasApplicationVisibility: (app: WtApplication) => boolean;
|
|
117
|
+
// hasSectionVisibility: (section: UiSection) => boolean;
|
|
118
|
+
}
|