|
1 | | -import { PermissionMetadata, ResourceMetadata, RoleMetadata } from 'types'; |
| 1 | +import { PermissionMetadata, ResourceMetadata } from 'types'; |
2 | 2 |
|
3 | 3 | export const CONTENT_LIBRARY_PERMISSIONS = { |
4 | 4 | DELETE_LIBRARY: 'content_libraries.delete_library', |
@@ -62,15 +62,6 @@ export const CONTENT_COURSE_PERMISSIONS = { |
62 | 62 | VIEW_COURSE_GLOBAL_STAFF_SUPER_ADMINS: 'courses.view_global_staff_and_superadmins', |
63 | 63 | }; |
64 | 64 |
|
65 | | -// Note: this information will eventually come from the backend API |
66 | | -// but for the MVP we decided to manage it in the frontend |
67 | | -export const libraryRolesMetadata: RoleMetadata[] = [ |
68 | | - { role: 'library_admin', name: 'Library Admin', description: 'The Library Admin has full control over the library, including managing users, modifying content, and handling publishing workflows. They ensure content is properly maintained and accessible as needed.' }, |
69 | | - { role: 'library_author', name: 'Library Author', description: 'The Library Author is responsible for creating, editing, and publishing content within a library. They can manage tags and collections but cannot delete libraries or manage users.' }, |
70 | | - { role: 'library_contributor', name: 'Library Contributor', description: 'The Library Contributor can create and edit content within a library but cannot publish it. They support the authoring process while leaving final publishing to Authors or Admins.' }, |
71 | | - { role: 'library_user', name: 'Library User', description: 'The Library User can view and reuse content but cannot edit or delete any resource.' }, |
72 | | -]; |
73 | | - |
74 | 65 | export const libraryResourceTypes: ResourceMetadata[] = [ |
75 | 66 | { key: 'library', label: 'Library', description: 'Permissions related to the library as a whole.' }, |
76 | 67 | { key: 'library_content', label: 'Content', description: 'Permissions to create, edit, delete, and publish individual content items within the library.' }, |
@@ -105,9 +96,21 @@ export const SKELETON_ROWS = Array.from({ length: 10 }).map(() => ({ |
105 | 96 | })); |
106 | 97 |
|
107 | 98 | export const ROUTES = { |
| 99 | + HOME_PATH: '/authz', |
108 | 100 | LIBRARIES_TEAM_PATH: '/libraries/:libraryId', |
109 | 101 | LIBRARIES_USER_PATH: '/libraries/:libraryId/:username', |
110 | 102 | AUDIT_USER_PATH: '/user/:username', |
| 103 | + ASSIGN_ROLE_WIZARD_PATH: '/assign-role', |
| 104 | +}; |
| 105 | + |
| 106 | +export const buildWizardPath = (options?: { users?: string; from?: string }) => { |
| 107 | + const base = `${ROUTES.HOME_PATH}${ROUTES.ASSIGN_ROLE_WIZARD_PATH}`; |
| 108 | + if (!options) { return base; } |
| 109 | + const params = new URLSearchParams(); |
| 110 | + if (options.users) { params.set('users', options.users); } |
| 111 | + if (options.from) { params.set('from', options.from); } |
| 112 | + const query = params.toString(); |
| 113 | + return query ? `${base}?${query}` : base; |
111 | 114 | }; |
112 | 115 |
|
113 | 116 | export enum RoleOperationErrorStatus { |
@@ -141,3 +144,11 @@ export const TABLE_DEFAULT_PAGE_SIZE = 10; |
141 | 144 |
|
142 | 145 | export const DEFAULT_FILTER_PAGE_SIZE = 5; |
143 | 146 | export const ADMIN_ROLES = ['course_admin', 'library_admin']; |
| 147 | + |
| 148 | +// Resource Type Definitions |
| 149 | +export const RESOURCE_TYPES = { |
| 150 | + LIBRARY: 'library', |
| 151 | + COURSE: 'course', |
| 152 | +} as const; |
| 153 | + |
| 154 | +export type ResourceType = typeof RESOURCE_TYPES[keyof typeof RESOURCE_TYPES]; |
0 commit comments