-
Notifications
You must be signed in to change notification settings - Fork 8
/
auth-roles.ts
34 lines (30 loc) · 1.2 KB
/
auth-roles.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
export const OSMT_ADMIN = "ROLE_Osmt_Admin"
export const OSMT_CURATOR = "ROLE_Osmt_Curator"
export const ENABLE_ROLES = true
export enum ButtonAction {
SkillUpdate,
SkillCreate,
SkillPublish,
CollectionUpdate,
CollectionCreate,
CollectionPublish,
CollectionSkillsUpdate,
LibraryExport,
ExportDraftCollection,
DeleteCollection,
MyWorkspace
}
export const ActionByRoles = new Map<number, string[]>([
[ButtonAction.SkillUpdate, [OSMT_ADMIN, OSMT_CURATOR]],
[ButtonAction.SkillCreate, [OSMT_ADMIN, OSMT_CURATOR]],
[ButtonAction.SkillPublish, [OSMT_ADMIN]],
[ButtonAction.CollectionUpdate, [OSMT_ADMIN, OSMT_CURATOR]],
[ButtonAction.CollectionCreate, [OSMT_ADMIN, OSMT_CURATOR]],
[ButtonAction.CollectionPublish, [OSMT_ADMIN]],
[ButtonAction.CollectionSkillsUpdate, [OSMT_ADMIN, OSMT_CURATOR]],
[ButtonAction.LibraryExport, [OSMT_ADMIN]],
[ButtonAction.ExportDraftCollection, [OSMT_ADMIN]],
[ButtonAction.DeleteCollection, [OSMT_ADMIN]],
[ButtonAction.MyWorkspace, [OSMT_ADMIN, OSMT_CURATOR]]
])
//TODO migrate AuthServiceWgu & AuthService.hasRole & isEnabledByRoles into a singleton here. HDN Sept 15, 2022