Skip to content

Commit 8083704

Browse files
refactor: adding namespace to permissions
1 parent a0dc22c commit 8083704

File tree

5 files changed

+21
-21
lines changed

5 files changed

+21
-21
lines changed

src/authz-module/libraries-manager/LibrariesTeamManager.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ describe('LibrariesTeamManager', () => {
7171
},
7272
],
7373
permissions: [
74-
{ key: 'view_library', label: 'view', resource: 'library' },
75-
{ key: 'edit_library', label: 'edit', resource: 'library' },
74+
{ key: 'content_libraries.view_library', label: 'view', resource: 'library' },
75+
{ key: 'content_libraries.edit_library', label: 'edit', resource: 'library' },
7676
],
7777
resources: [{ key: 'library', label: 'Library' }],
7878
canManageTeam: true,

src/authz-module/libraries-manager/components/TeamTable/index.test.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ describe('TeamTable', () => {
4545
{
4646
role: 'admin',
4747
permissions: [
48-
'delete_library',
49-
'publish_library',
50-
'manage_library_team',
48+
'content_libraries.delete_library',
49+
'content_libraries.publish_library_content',
50+
'content_libraries.manage_library_team',
5151
],
5252
userCount: 3,
5353
name: 'Admin',
@@ -56,8 +56,8 @@ describe('TeamTable', () => {
5656
{
5757
role: 'editor',
5858
permissions: [
59-
'edit_library',
60-
'publish_library',
59+
'content_libraries.edit_library_content',
60+
'content_libraries.publish_library_content',
6161
],
6262
userCount: 3,
6363
name: 'Editor',
@@ -66,7 +66,7 @@ describe('TeamTable', () => {
6666
{
6767
role: 'viewer',
6868
permissions: [
69-
'view_library',
69+
'content_libraries.view_library',
7070
],
7171
userCount: 3,
7272
name: 'Viewer',

src/authz-module/libraries-manager/constants.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,18 @@ export const libraryResourceTypes: ResourceMetadata[] = [
1717
];
1818

1919
export const libraryPermissions: PermissionMetadata[] = [
20-
{ key: 'delete_library', resource: 'library', description: 'Allows the user to delete the library and all its contents.' },
21-
{ key: 'manage_library_tags', resource: 'library', description: 'Add or remove tags from content.' },
22-
{ key: 'view_library', resource: 'library', description: 'View content, search, filter, and sort within the library.' },
20+
{ key: 'content_libraries.delete_library', resource: 'library', description: 'Allows the user to delete the library and all its contents.' },
21+
{ key: 'content_libraries.manage_library_tags', resource: 'library', description: 'Add or remove tags from content.' },
22+
{ key: 'content_libraries.view_library', resource: 'library', description: 'View content, search, filter, and sort within the library.' },
2323

24-
{ key: 'edit_library_content', resource: 'library_content', description: 'Edit content in draft mode' },
25-
{ key: 'publish_library_content', resource: 'library_content', description: 'Publish content, making it available for reuse' },
26-
{ key: 'reuse_library_content', resource: 'library_content', description: 'Reuse published content within a course.' },
24+
{ key: 'content_libraries.edit_library_content', resource: 'library_content', description: 'Edit content in draft mode' },
25+
{ key: 'content_libraries.publish_library_content', resource: 'library_content', description: 'Publish content, making it available for reuse' },
26+
{ key: 'content_libraries.reuse_library_content', resource: 'library_content', description: 'Reuse published content within a course.' },
2727

28-
{ key: 'create_library_collection', resource: 'library_collection', description: 'Create new collections within a library.' },
29-
{ key: 'edit_library_collection', resource: 'library_collection', description: 'Add or remove content from existing collections.' },
30-
{ key: 'delete_library_collection', resource: 'library_collection', description: 'Delete entire collections from the library.' },
28+
{ key: 'content_libraries.create_library_collection', resource: 'library_collection', description: 'Create new collections within a library.' },
29+
{ key: 'content_libraries.edit_library_collection', resource: 'library_collection', description: 'Add or remove content from existing collections.' },
30+
{ key: 'content_libraries.delete_library_collection', resource: 'library_collection', description: 'Delete entire collections from the library.' },
3131

32-
{ key: 'manage_library_team', resource: 'library_team', description: 'View the list of users who have access to the library.' },
33-
{ key: 'view_library_team', resource: 'library_team', description: 'Add, remove, and assign roles to users within the library.' },
32+
{ key: 'content_libraries.manage_library_team', resource: 'library_team', description: 'View the list of users who have access to the library.' },
33+
{ key: 'content_libraries.view_library_team', resource: 'library_team', description: 'Add, remove, and assign roles to users within the library.' },
3434
];

src/authz-module/libraries-manager/context.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jest.mock('@src/authz-module/data/hooks', () => ({
2020
data: [
2121
{
2222
role: 'library_author',
23-
permissions: ['view_library_team', 'edit_library'],
23+
permissions: ['content_libraries.view_library_team', 'content_libraries.edit_library_content'],
2424
user_count: 12,
2525
},
2626
],

src/authz-module/libraries-manager/context.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { PermissionMetadata, ResourceMetadata, Role } from 'types';
99
import { CustomErrors } from '@src/constants';
1010
import { libraryPermissions, libraryResourceTypes, libraryRolesMetadata } from './constants';
1111

12-
const LIBRARY_TEAM_PERMISSIONS = ['view_library_team', 'manage_library_team'];
12+
const LIBRARY_TEAM_PERMISSIONS = ['content_libraries.view_library_team', 'content_libraries.manage_library_team'];
1313

1414
export type AppContextType = {
1515
authenticatedUser: {

0 commit comments

Comments
 (0)