Skip to content

Commit 291f911

Browse files
committed
feat: storing role and permissions on claim
1 parent 0b4ed58 commit 291f911

File tree

18 files changed

+13123
-472
lines changed

18 files changed

+13123
-472
lines changed

client/projects/cms/src/app/modules/dashboard/modules/module-instance/guards/can-read-module/can-read-module.guard.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export class CanReadModuleGuard implements CanActivate {
2626
map(modules => {
2727
const module = findModule(modules, route.params);
2828

29-
if (this.state.permissions[module.id]?.list) {
29+
if (!this.state.permissions[module.id]?.list) {
3030
this.router.navigate(STATIC_CONFIG.dashboardRoute);
3131
return false;
3232
}
Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import {Collections} from '../interfaces/collections';
2+
import {MODULES} from '../modules/modules';
23

34
export const ROLES_COLLECTION = {
45
name: Collections.Roles,
@@ -7,13 +8,18 @@ export const ROLES_COLLECTION = {
78
id: 'admin',
89
name: 'Admin',
910
description: 'A user with access to all collections',
10-
createdOn: Date.now()
11+
createdOn: Date.now(),
12+
permissions: MODULES.reduce((acc, cur) => {
13+
acc[cur.id] = {get: true, list: true, create: true, update: true, delete: true};
14+
return acc;
15+
}, {})
1116
},
1217
{
1318
id: 'user',
1419
name: 'User',
1520
description: 'A user with limited application access',
16-
createdOn: Date.now()
21+
createdOn: Date.now(),
22+
permissions: {}
1723
}
1824
]
1925
};

0 commit comments

Comments
 (0)