Skip to content

Commit

Permalink
feat: add permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
SzymonMrzyglod committed Jan 24, 2024
1 parent 2d32e43 commit 244eeee
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/access.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export default function (initialState: {
PERMISSIONS.CourseList,
PERMISSIONS.H5PList,
PERMISSIONS.ScormList,
PERMISSIONS.ScormListOwn,
PERMISSIONS.CategoryList,
PERMISSIONS.WebinarList,
) && !haveSettingsInDashboard('hideInMenu-Courses', true),
Expand All @@ -109,10 +110,13 @@ export default function (initialState: {
),

scormListPermission:
havePermissionsInDashboard(PERMISSIONS.ScormList) &&
havePermissionsInDashboard(PERMISSIONS.ScormList, PERMISSIONS.ScormListOwn) &&
!haveSettingsInDashboard('hideInMenu-CoursesH5ps', true) &&
!haveSettingsInDashboard('disableTopicType-SCORM', true),
scormDetailsPermission: havePermissionsInDashboard(PERMISSIONS.ScormRead),
scormDetailsPermission: havePermissionsInDashboard(
PERMISSIONS.ScormRead,
PERMISSIONS.ScormReadOwn,
),

pageListPermission: havePermissionsInDashboard(PERMISSIONS.PageList),
pageDetailsPermission: havePermissionsInDashboard(PERMISSIONS.PageRead),
Expand Down
3 changes: 3 additions & 0 deletions src/consts/permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ enum PERMISSIONS {
ScormDelete = 'scorm_delete',
ScormGetTrack = 'scorm_track-read',
ScormSetTrack = 'scorm_track-update',
ScormListOwn = 'scorm_list-own',
ScormReadOwn = 'scorm_read-own',
ScormDeleteOwn = 'scorm_delete-own',

/* -------- EscolaLMS/Reports -------- */

Expand Down

0 comments on commit 244eeee

Please sign in to comment.