@openedx/frontend-app-admin-console 1.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +661 -0
- package/README.rst +164 -0
- package/dist/Main.d.ts +3 -0
- package/dist/Main.js +15 -0
- package/dist/Main.js.map +1 -0
- package/dist/app.d.ts +3 -0
- package/dist/app.js +10 -0
- package/dist/app.js.map +1 -0
- package/dist/authz-module/audit-user/index.d.ts +2 -0
- package/dist/authz-module/audit-user/index.js +191 -0
- package/dist/authz-module/audit-user/index.js.map +1 -0
- package/dist/authz-module/audit-user/messages.d.ts +58 -0
- package/dist/authz-module/audit-user/messages.js +60 -0
- package/dist/authz-module/audit-user/messages.js.map +1 -0
- package/dist/authz-module/authz-home/index.d.ts +2 -0
- package/dist/authz-module/authz-home/index.js +23 -0
- package/dist/authz-module/authz-home/index.js.map +1 -0
- package/dist/authz-module/authz-home/messages.d.ts +23 -0
- package/dist/authz-module/authz-home/messages.js +25 -0
- package/dist/authz-module/authz-home/messages.js.map +1 -0
- package/dist/authz-module/components/AddRoleButton.d.ts +6 -0
- package/dist/authz-module/components/AddRoleButton.js +22 -0
- package/dist/authz-module/components/AddRoleButton.js.map +1 -0
- package/dist/authz-module/components/AnchorButton.d.ts +2 -0
- package/dist/authz-module/components/AnchorButton.js +35 -0
- package/dist/authz-module/components/AnchorButton.js.map +1 -0
- package/dist/authz-module/components/AuthZLayout.d.ts +12 -0
- package/dist/authz-module/components/AuthZLayout.js +19 -0
- package/dist/authz-module/components/AuthZLayout.js.map +1 -0
- package/dist/authz-module/components/AuthZTitle.d.ts +20 -0
- package/dist/authz-module/components/AuthZTitle.js +22 -0
- package/dist/authz-module/components/AuthZTitle.js.map +1 -0
- package/dist/authz-module/components/ConfirmDeletionModal.d.ts +15 -0
- package/dist/authz-module/components/ConfirmDeletionModal.js +21 -0
- package/dist/authz-module/components/ConfirmDeletionModal.js.map +1 -0
- package/dist/authz-module/components/ErrorPage/index.d.ts +3 -0
- package/dist/authz-module/components/ErrorPage/index.js +59 -0
- package/dist/authz-module/components/ErrorPage/index.js.map +1 -0
- package/dist/authz-module/components/ErrorPage/messages.d.ts +53 -0
- package/dist/authz-module/components/ErrorPage/messages.js +55 -0
- package/dist/authz-module/components/ErrorPage/messages.js.map +1 -0
- package/dist/authz-module/components/PermissionTable.d.ts +9 -0
- package/dist/authz-module/components/PermissionTable.js +24 -0
- package/dist/authz-module/components/PermissionTable.js.map +1 -0
- package/dist/authz-module/components/RenderAdminRole.d.ts +5 -0
- package/dist/authz-module/components/RenderAdminRole.js +13 -0
- package/dist/authz-module/components/RenderAdminRole.js.map +1 -0
- package/dist/authz-module/components/RenderPermissionColumn.d.ts +6 -0
- package/dist/authz-module/components/RenderPermissionColumn.js +8 -0
- package/dist/authz-module/components/RenderPermissionColumn.js.map +1 -0
- package/dist/authz-module/components/RenderPermissionInLine.d.ts +6 -0
- package/dist/authz-module/components/RenderPermissionInLine.js +8 -0
- package/dist/authz-module/components/RenderPermissionInLine.js.map +1 -0
- package/dist/authz-module/components/ResourceTooltip.d.ts +11 -0
- package/dist/authz-module/components/ResourceTooltip.js +9 -0
- package/dist/authz-module/components/ResourceTooltip.js.map +1 -0
- package/dist/authz-module/components/RoleCard/constants.d.ts +14 -0
- package/dist/authz-module/components/RoleCard/constants.js +15 -0
- package/dist/authz-module/components/RoleCard/constants.js.map +1 -0
- package/dist/authz-module/components/RoleCard/messages.d.ts +73 -0
- package/dist/authz-module/components/RoleCard/messages.js +75 -0
- package/dist/authz-module/components/RoleCard/messages.js.map +1 -0
- package/dist/authz-module/components/TableCells.d.ts +29 -0
- package/dist/authz-module/components/TableCells.js +137 -0
- package/dist/authz-module/components/TableCells.js.map +1 -0
- package/dist/authz-module/components/TableControlBar/MultipleChoiceFilter.d.ts +3 -0
- package/dist/authz-module/components/TableControlBar/MultipleChoiceFilter.js +47 -0
- package/dist/authz-module/components/TableControlBar/MultipleChoiceFilter.js.map +1 -0
- package/dist/authz-module/components/TableControlBar/OrgFilter.d.ts +5 -0
- package/dist/authz-module/components/TableControlBar/OrgFilter.js +36 -0
- package/dist/authz-module/components/TableControlBar/OrgFilter.js.map +1 -0
- package/dist/authz-module/components/TableControlBar/RolesFilter.d.ts +4 -0
- package/dist/authz-module/components/TableControlBar/RolesFilter.js +29 -0
- package/dist/authz-module/components/TableControlBar/RolesFilter.js.map +1 -0
- package/dist/authz-module/components/TableControlBar/ScopesFilter.d.ts +4 -0
- package/dist/authz-module/components/TableControlBar/ScopesFilter.js +45 -0
- package/dist/authz-module/components/TableControlBar/ScopesFilter.js.map +1 -0
- package/dist/authz-module/components/TableControlBar/SearchFilter.d.ts +7 -0
- package/dist/authz-module/components/TableControlBar/SearchFilter.js +8 -0
- package/dist/authz-module/components/TableControlBar/SearchFilter.js.map +1 -0
- package/dist/authz-module/components/TableControlBar/TableControlBar.d.ts +5 -0
- package/dist/authz-module/components/TableControlBar/TableControlBar.js +99 -0
- package/dist/authz-module/components/TableControlBar/TableControlBar.js.map +1 -0
- package/dist/authz-module/components/TableControlBar/types.d.ts +18 -0
- package/dist/authz-module/components/TableControlBar/types.js +2 -0
- package/dist/authz-module/components/TableControlBar/types.js.map +1 -0
- package/dist/authz-module/components/TableFooter/TableFooter.d.ts +2 -0
- package/dist/authz-module/components/TableFooter/TableFooter.js +15 -0
- package/dist/authz-module/components/TableFooter/TableFooter.js.map +1 -0
- package/dist/authz-module/components/UserPermissions.d.ts +9 -0
- package/dist/authz-module/components/UserPermissions.js +56 -0
- package/dist/authz-module/components/UserPermissions.js.map +1 -0
- package/dist/authz-module/components/ViewMoreLink.d.ts +8 -0
- package/dist/authz-module/components/ViewMoreLink.js +8 -0
- package/dist/authz-module/components/ViewMoreLink.js.map +1 -0
- package/dist/authz-module/components/constants.d.ts +13 -0
- package/dist/authz-module/components/constants.js +80 -0
- package/dist/authz-module/components/constants.js.map +1 -0
- package/dist/authz-module/components/messages.d.ts +183 -0
- package/dist/authz-module/components/messages.js +185 -0
- package/dist/authz-module/components/messages.js.map +1 -0
- package/dist/authz-module/constants.d.ts +38 -0
- package/dist/authz-module/constants.js +77 -0
- package/dist/authz-module/constants.js.map +1 -0
- package/dist/authz-module/data/api.d.ts +109 -0
- package/dist/authz-module/data/api.js +107 -0
- package/dist/authz-module/data/api.js.map +1 -0
- package/dist/authz-module/data/hooks.d.ts +94 -0
- package/dist/authz-module/data/hooks.js +191 -0
- package/dist/authz-module/data/hooks.js.map +1 -0
- package/dist/authz-module/hooks/useCourseAuthoringFlag.d.ts +26 -0
- package/dist/authz-module/hooks/useCourseAuthoringFlag.js +86 -0
- package/dist/authz-module/hooks/useCourseAuthoringFlag.js.map +1 -0
- package/dist/authz-module/hooks/useQuerySettings.d.ts +27 -0
- package/dist/authz-module/hooks/useQuerySettings.js +72 -0
- package/dist/authz-module/hooks/useQuerySettings.js.map +1 -0
- package/dist/authz-module/hooks/useViewTeamPermissions.d.ts +5 -0
- package/dist/authz-module/hooks/useViewTeamPermissions.js +13 -0
- package/dist/authz-module/hooks/useViewTeamPermissions.js.map +1 -0
- package/dist/authz-module/index.d.ts +3 -0
- package/dist/authz-module/index.js +20 -0
- package/dist/authz-module/index.js.map +1 -0
- package/dist/authz-module/index.scss +131 -0
- package/dist/authz-module/messages.d.ts +48 -0
- package/dist/authz-module/messages.js +50 -0
- package/dist/authz-module/messages.js.map +1 -0
- package/dist/authz-module/role-assignation-wizard/AssignRoleWizard.d.ts +8 -0
- package/dist/authz-module/role-assignation-wizard/AssignRoleWizard.js +154 -0
- package/dist/authz-module/role-assignation-wizard/AssignRoleWizard.js.map +1 -0
- package/dist/authz-module/role-assignation-wizard/AssignRoleWizardPage.d.ts +2 -0
- package/dist/authz-module/role-assignation-wizard/AssignRoleWizardPage.js +39 -0
- package/dist/authz-module/role-assignation-wizard/AssignRoleWizardPage.js.map +1 -0
- package/dist/authz-module/role-assignation-wizard/components/DefineApplicationScopeStep.d.ts +8 -0
- package/dist/authz-module/role-assignation-wizard/components/DefineApplicationScopeStep.js +39 -0
- package/dist/authz-module/role-assignation-wizard/components/DefineApplicationScopeStep.js.map +1 -0
- package/dist/authz-module/role-assignation-wizard/components/HighlightedUsersInput.d.ts +11 -0
- package/dist/authz-module/role-assignation-wizard/components/HighlightedUsersInput.js +36 -0
- package/dist/authz-module/role-assignation-wizard/components/HighlightedUsersInput.js.map +1 -0
- package/dist/authz-module/role-assignation-wizard/components/OrgSection.d.ts +10 -0
- package/dist/authz-module/role-assignation-wizard/components/OrgSection.js +14 -0
- package/dist/authz-module/role-assignation-wizard/components/OrgSection.js.map +1 -0
- package/dist/authz-module/role-assignation-wizard/components/ScopeCheckboxItem.d.ts +8 -0
- package/dist/authz-module/role-assignation-wizard/components/ScopeCheckboxItem.js +5 -0
- package/dist/authz-module/role-assignation-wizard/components/ScopeCheckboxItem.js.map +1 -0
- package/dist/authz-module/role-assignation-wizard/components/ScopeFilterBar.d.ts +12 -0
- package/dist/authz-module/role-assignation-wizard/components/ScopeFilterBar.js +12 -0
- package/dist/authz-module/role-assignation-wizard/components/ScopeFilterBar.js.map +1 -0
- package/dist/authz-module/role-assignation-wizard/components/ScopeList.d.ts +20 -0
- package/dist/authz-module/role-assignation-wizard/components/ScopeList.js +30 -0
- package/dist/authz-module/role-assignation-wizard/components/ScopeList.js.map +1 -0
- package/dist/authz-module/role-assignation-wizard/components/SelectUsersAndRoleStep.d.ts +12 -0
- package/dist/authz-module/role-assignation-wizard/components/SelectUsersAndRoleStep.js +34 -0
- package/dist/authz-module/role-assignation-wizard/components/SelectUsersAndRoleStep.js.map +1 -0
- package/dist/authz-module/role-assignation-wizard/constants.d.ts +5 -0
- package/dist/authz-module/role-assignation-wizard/constants.js +6 -0
- package/dist/authz-module/role-assignation-wizard/constants.js.map +1 -0
- package/dist/authz-module/role-assignation-wizard/hooks/useScopeListData.d.ts +23 -0
- package/dist/authz-module/role-assignation-wizard/hooks/useScopeListData.js +112 -0
- package/dist/authz-module/role-assignation-wizard/hooks/useScopeListData.js.map +1 -0
- package/dist/authz-module/role-assignation-wizard/hooks/useScopePermissions.d.ts +10 -0
- package/dist/authz-module/role-assignation-wizard/hooks/useScopePermissions.js +54 -0
- package/dist/authz-module/role-assignation-wizard/hooks/useScopePermissions.js.map +1 -0
- package/dist/authz-module/role-assignation-wizard/messages.d.ts +243 -0
- package/dist/authz-module/role-assignation-wizard/messages.js +258 -0
- package/dist/authz-module/role-assignation-wizard/messages.js.map +1 -0
- package/dist/authz-module/role-assignation-wizard/utils.d.ts +5 -0
- package/dist/authz-module/role-assignation-wizard/utils.js +16 -0
- package/dist/authz-module/role-assignation-wizard/utils.js.map +1 -0
- package/dist/authz-module/roles-permissions/RolesPermissions.d.ts +2 -0
- package/dist/authz-module/roles-permissions/RolesPermissions.js +35 -0
- package/dist/authz-module/roles-permissions/RolesPermissions.js.map +1 -0
- package/dist/authz-module/roles-permissions/course/constants.d.ts +39 -0
- package/dist/authz-module/roles-permissions/course/constants.js +474 -0
- package/dist/authz-module/roles-permissions/course/constants.js.map +1 -0
- package/dist/authz-module/roles-permissions/index.d.ts +10 -0
- package/dist/authz-module/roles-permissions/index.js +15 -0
- package/dist/authz-module/roles-permissions/index.js.map +1 -0
- package/dist/authz-module/roles-permissions/library/constants.d.ts +18 -0
- package/dist/authz-module/roles-permissions/library/constants.js +193 -0
- package/dist/authz-module/roles-permissions/library/constants.js.map +1 -0
- package/dist/authz-module/roles-permissions/messages.d.ts +63 -0
- package/dist/authz-module/roles-permissions/messages.js +65 -0
- package/dist/authz-module/roles-permissions/messages.js.map +1 -0
- package/dist/authz-module/roles-permissions/utils.d.ts +41 -0
- package/dist/authz-module/roles-permissions/utils.js +70 -0
- package/dist/authz-module/roles-permissions/utils.js.map +1 -0
- package/dist/authz-module/team-members/TeamMembersTable.d.ts +5 -0
- package/dist/authz-module/team-members/TeamMembersTable.js +107 -0
- package/dist/authz-module/team-members/TeamMembersTable.js.map +1 -0
- package/dist/authz-module/team-members/messages.d.ts +33 -0
- package/dist/authz-module/team-members/messages.js +35 -0
- package/dist/authz-module/team-members/messages.js.map +1 -0
- package/dist/authz-module/utils.d.ts +24 -0
- package/dist/authz-module/utils.js +45 -0
- package/dist/authz-module/utils.js.map +1 -0
- package/dist/components/LoadingPage.d.ts +2 -0
- package/dist/components/LoadingPage.js +5 -0
- package/dist/components/LoadingPage.js.map +1 -0
- package/dist/components/ToastManager/ToastManagerContext.d.ts +24 -0
- package/dist/components/ToastManager/ToastManagerContext.js +91 -0
- package/dist/components/ToastManager/ToastManagerContext.js.map +1 -0
- package/dist/constants.d.ts +11 -0
- package/dist/constants.js +15 -0
- package/dist/constants.js.map +1 -0
- package/dist/data/api.d.ts +4 -0
- package/dist/data/api.js +21 -0
- package/dist/data/api.js.map +1 -0
- package/dist/data/hooks.d.ts +38 -0
- package/dist/data/hooks.js +69 -0
- package/dist/data/hooks.js.map +1 -0
- package/dist/data/types.d.ts +38 -0
- package/dist/data/types.js +2 -0
- package/dist/data/types.js.map +1 -0
- package/dist/data/utils.d.ts +6 -0
- package/dist/data/utils.js +11 -0
- package/dist/data/utils.js.map +1 -0
- package/dist/i18n/index.d.ts +1 -0
- package/dist/i18n/index.js +2 -0
- package/dist/i18n/index.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/messages.d.ts +8 -0
- package/dist/messages.js +10 -0
- package/dist/messages.js.map +1 -0
- package/dist/providers.d.ts +3 -0
- package/dist/providers.js +4 -0
- package/dist/providers.js.map +1 -0
- package/dist/routes.d.ts +11 -0
- package/dist/routes.js +16 -0
- package/dist/routes.js.map +1 -0
- package/dist/style.scss +15 -0
- package/dist/types.d.ts +93 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +88 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { useValidateUserPermissions } from '../../../data/hooks';
|
|
3
|
+
import { getOrgAggregateScopeKey, getPlatformAggregateScopeKey } from '../../constants';
|
|
4
|
+
import { CONTENT_COURSE_PERMISSIONS, CONTENT_LIBRARY_PERMISSIONS } from '../../roles-permissions';
|
|
5
|
+
const useScopePermissions = ({ contextType, orderedOrgs, }) => {
|
|
6
|
+
var _a;
|
|
7
|
+
// Validate the platform-wide aggregate (course-v1:* / lib:*) and one org-level
|
|
8
|
+
// aggregate (course-v1:Org+* / lib:Org:*) per org in a single request; `action`
|
|
9
|
+
// is the same for every scope.
|
|
10
|
+
const typedContext = contextType;
|
|
11
|
+
// 1. Build the API request payload
|
|
12
|
+
const permissionRequests = useMemo(() => {
|
|
13
|
+
if (!typedContext)
|
|
14
|
+
return [];
|
|
15
|
+
const action = typedContext === 'course'
|
|
16
|
+
? CONTENT_COURSE_PERMISSIONS.MANAGE_COURSE_TEAM
|
|
17
|
+
: CONTENT_LIBRARY_PERMISSIONS.MANAGE_LIBRARY_TEAM;
|
|
18
|
+
const platformRequest = { action, scope: getPlatformAggregateScopeKey(typedContext) };
|
|
19
|
+
const orgRequests = orderedOrgs.map((org) => ({
|
|
20
|
+
action,
|
|
21
|
+
scope: getOrgAggregateScopeKey(typedContext, org),
|
|
22
|
+
}));
|
|
23
|
+
return [platformRequest, ...orgRequests];
|
|
24
|
+
}, [orderedOrgs, typedContext]);
|
|
25
|
+
const { data: perms } = useValidateUserPermissions(permissionRequests);
|
|
26
|
+
// 2. Create a lightweight index for fast lookups
|
|
27
|
+
// Indexed by the `scope` the API echoes back on each result.
|
|
28
|
+
const allowedByScope = useMemo(() => {
|
|
29
|
+
const byScope = Object.create(null);
|
|
30
|
+
perms === null || perms === void 0 ? void 0 : perms.forEach(({ scope, allowed }) => {
|
|
31
|
+
if (scope !== undefined)
|
|
32
|
+
byScope[scope] = allowed;
|
|
33
|
+
});
|
|
34
|
+
return byScope;
|
|
35
|
+
}, [perms]);
|
|
36
|
+
// 3. Extract platform-wide permission
|
|
37
|
+
const hasPlatformPermission = !!typedContext
|
|
38
|
+
&& ((_a = allowedByScope[getPlatformAggregateScopeKey(typedContext)]) !== null && _a !== void 0 ? _a : false);
|
|
39
|
+
// 4. Map permissions back to the requested Orgs
|
|
40
|
+
const orgHasPermission = useMemo(() => {
|
|
41
|
+
const result = {};
|
|
42
|
+
if (typedContext) {
|
|
43
|
+
orderedOrgs.forEach((org) => {
|
|
44
|
+
var _a;
|
|
45
|
+
const scope = getOrgAggregateScopeKey(typedContext, org);
|
|
46
|
+
result[org] = (_a = allowedByScope[scope]) !== null && _a !== void 0 ? _a : false;
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
return result;
|
|
50
|
+
}, [orderedOrgs, typedContext, allowedByScope]);
|
|
51
|
+
return { hasPlatformPermission, orgHasPermission };
|
|
52
|
+
};
|
|
53
|
+
export default useScopePermissions;
|
|
54
|
+
//# sourceMappingURL=useScopePermissions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useScopePermissions.js","sourceRoot":"","sources":["../../../../src/authz-module/role-assignation-wizard/hooks/useScopePermissions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,uBAAuB,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAC;AAEpG,OAAO,EAAE,0BAA0B,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAC;AAY9G,MAAM,mBAAmB,GAAG,CAAC,EAC3B,WAAW,EACX,WAAW,GACe,EAA6B,EAAE;;IACzD,+EAA+E;IAC/E,gFAAgF;IAChF,+BAA+B;IAC/B,MAAM,YAAY,GAAG,WAA0B,CAAC;IAEhD,mCAAmC;IACnC,MAAM,kBAAkB,GAAG,OAAO,CAAC,GAAG,EAAE;QACtC,IAAI,CAAC,YAAY;YAAE,OAAO,EAAE,CAAC;QAE7B,MAAM,MAAM,GAAG,YAAY,KAAK,QAAQ;YACtC,CAAC,CAAC,0BAA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Y,EAAE,CAAC;YACjB,WAAW,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;;gBAC1B,MAAM,KAAK,GAAG,uBAAuB,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC;gBACzD,MAAM,CAAC,GAAG,CAAC,GAAG,MAAA,cAAc,CAAC,KAAK,CAAC,mCAAI,KAAK,CAAC;YAC/C,CAAC,CAAC,CAAC;QACL,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC,EAAE,CAAC,WAAW,EAAE,YAAY,EAAE,cAAc,CAAC,CAAC,CAAC;IAEhD,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,CAAC;AACrD,CAAC,CAAC;AAEF,eAAe,mBAAmB,CAAC","sourcesContent":["import { useMemo } from 'react';\nimport { useValidateUserPermissions } from '@src/data/hooks';\nimport { getOrgAggregateScopeKey, getPlatformAggregateScopeKey } from '@src/authz-module/constants';\nimport type { ContextType } from '@src/authz-module/constants';\nimport { CONTENT_COURSE_PERMISSIONS, CONTENT_LIBRARY_PERMISSIONS } from '@src/authz-module/roles-permissions';\n\ninterface UseScopePermissionsParams {\n contextType: string | undefined;\n orderedOrgs: string[];\n}\n\ninterface UseScopePermissionsResult {\n hasPlatformPermission: boolean;\n orgHasPermission: Record<string, boolean>;\n}\n\nconst useScopePermissions = ({\n contextType,\n orderedOrgs,\n}: UseScopePermissionsParams): UseScopePermissionsResult => {\n // Validate the platform-wide aggregate (course-v1:* / lib:*) and one org-level\n // aggregate (course-v1:Org+* / lib:Org:*) per org in a single request; `action`\n // is the same for every scope.\n const typedContext = contextType as ContextType;\n\n // 1. Build the API request payload\n const permissionRequests = useMemo(() => {\n if (!typedContext) return [];\n\n const action = typedContext === 'course'\n ? CONTENT_COURSE_PERMISSIONS.MANAGE_COURSE_TEAM\n : CONTENT_LIBRARY_PERMISSIONS.MANAGE_LIBRARY_TEAM;\n\n const platformRequest = { action, scope: getPlatformAggregateScopeKey(typedContext) };\n const orgRequests = orderedOrgs.map((org) => ({\n action,\n scope: getOrgAggregateScopeKey(typedContext, org),\n }));\n\n return [platformRequest, ...orgRequests];\n }, [orderedOrgs, typedContext]);\n\n const { data: perms } = useValidateUserPermissions(permissionRequests);\n\n // 2. Create a lightweight index for fast lookups\n // Indexed by the `scope` the API echoes back on each result.\n const allowedByScope = useMemo(() => {\n const byScope: Record<string, boolean> = Object.create(null);\n perms?.forEach(({ scope, allowed }) => {\n if (scope !== undefined) byScope[scope] = allowed;\n });\n return byScope;\n }, [perms]);\n\n // 3. Extract platform-wide permission\n const hasPlatformPermission = !!typedContext\n && (allowedByScope[getPlatformAggregateScopeKey(typedContext)] ?? false);\n\n // 4. Map permissions back to the requested Orgs\n const orgHasPermission = useMemo(() => {\n const result: Record<string, boolean> = {};\n if (typedContext) {\n orderedOrgs.forEach((org) => {\n const scope = getOrgAggregateScopeKey(typedContext, org);\n result[org] = allowedByScope[scope] ?? false;\n });\n }\n return result;\n }, [orderedOrgs, typedContext, allowedByScope]);\n\n return { hasPlatformPermission, orgHasPermission };\n};\n\nexport default useScopePermissions;\n"]}
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
declare const messages: {
|
|
2
|
+
'wizard.page.breadcrumb': {
|
|
3
|
+
id: string;
|
|
4
|
+
defaultMessage: string;
|
|
5
|
+
description: string;
|
|
6
|
+
};
|
|
7
|
+
'wizard.page.title': {
|
|
8
|
+
id: string;
|
|
9
|
+
defaultMessage: string;
|
|
10
|
+
description: string;
|
|
11
|
+
};
|
|
12
|
+
'wizard.step.selectUsersAndRole.error': {
|
|
13
|
+
id: string;
|
|
14
|
+
defaultMessage: string;
|
|
15
|
+
description: string;
|
|
16
|
+
};
|
|
17
|
+
'wizard.step.selectUsersAndRole.title': {
|
|
18
|
+
id: string;
|
|
19
|
+
defaultMessage: string;
|
|
20
|
+
description: string;
|
|
21
|
+
};
|
|
22
|
+
'wizard.step.defineScope.title': {
|
|
23
|
+
id: string;
|
|
24
|
+
defaultMessage: string;
|
|
25
|
+
description: string;
|
|
26
|
+
};
|
|
27
|
+
'wizard.button.cancel': {
|
|
28
|
+
id: string;
|
|
29
|
+
defaultMessage: string;
|
|
30
|
+
description: string;
|
|
31
|
+
};
|
|
32
|
+
'wizard.button.back': {
|
|
33
|
+
id: string;
|
|
34
|
+
defaultMessage: string;
|
|
35
|
+
description: string;
|
|
36
|
+
};
|
|
37
|
+
'wizard.button.next': {
|
|
38
|
+
id: string;
|
|
39
|
+
defaultMessage: string;
|
|
40
|
+
description: string;
|
|
41
|
+
};
|
|
42
|
+
'wizard.button.next.pending': {
|
|
43
|
+
id: string;
|
|
44
|
+
defaultMessage: string;
|
|
45
|
+
description: string;
|
|
46
|
+
};
|
|
47
|
+
'wizard.button.save': {
|
|
48
|
+
id: string;
|
|
49
|
+
defaultMessage: string;
|
|
50
|
+
description: string;
|
|
51
|
+
};
|
|
52
|
+
'wizard.button.save.pending': {
|
|
53
|
+
id: string;
|
|
54
|
+
defaultMessage: string;
|
|
55
|
+
description: string;
|
|
56
|
+
};
|
|
57
|
+
'wizard.save.success': {
|
|
58
|
+
id: string;
|
|
59
|
+
defaultMessage: string;
|
|
60
|
+
description: string;
|
|
61
|
+
};
|
|
62
|
+
'wizard.save.errors.summary': {
|
|
63
|
+
id: string;
|
|
64
|
+
defaultMessage: string;
|
|
65
|
+
description: string;
|
|
66
|
+
};
|
|
67
|
+
'wizard.step2.errors.alert.title': {
|
|
68
|
+
id: string;
|
|
69
|
+
defaultMessage: string;
|
|
70
|
+
description: string;
|
|
71
|
+
};
|
|
72
|
+
'wizard.save.error.user_already_has_role': {
|
|
73
|
+
id: string;
|
|
74
|
+
defaultMessage: string;
|
|
75
|
+
description: string;
|
|
76
|
+
};
|
|
77
|
+
'wizard.save.error.user_not_found': {
|
|
78
|
+
id: string;
|
|
79
|
+
defaultMessage: string;
|
|
80
|
+
description: string;
|
|
81
|
+
};
|
|
82
|
+
'wizard.save.error.role_assignment_error': {
|
|
83
|
+
id: string;
|
|
84
|
+
defaultMessage: string;
|
|
85
|
+
description: string;
|
|
86
|
+
};
|
|
87
|
+
'wizard.save.error.default': {
|
|
88
|
+
id: string;
|
|
89
|
+
defaultMessage: string;
|
|
90
|
+
description: string;
|
|
91
|
+
};
|
|
92
|
+
'wizard.step2.search.placeholder': {
|
|
93
|
+
id: string;
|
|
94
|
+
defaultMessage: string;
|
|
95
|
+
description: string;
|
|
96
|
+
};
|
|
97
|
+
'wizard.step2.filter.org.label': {
|
|
98
|
+
id: string;
|
|
99
|
+
defaultMessage: string;
|
|
100
|
+
description: string;
|
|
101
|
+
};
|
|
102
|
+
'wizard.step2.filter.org.all': {
|
|
103
|
+
id: string;
|
|
104
|
+
defaultMessage: string;
|
|
105
|
+
description: string;
|
|
106
|
+
};
|
|
107
|
+
'wizard.step2.filter.applied': {
|
|
108
|
+
id: string;
|
|
109
|
+
defaultMessage: string;
|
|
110
|
+
description: string;
|
|
111
|
+
};
|
|
112
|
+
'wizard.step2.count': {
|
|
113
|
+
id: string;
|
|
114
|
+
defaultMessage: string;
|
|
115
|
+
description: string;
|
|
116
|
+
};
|
|
117
|
+
'wizard.step1.users.heading': {
|
|
118
|
+
id: string;
|
|
119
|
+
defaultMessage: string;
|
|
120
|
+
description: string;
|
|
121
|
+
};
|
|
122
|
+
'wizard.step1.users.label': {
|
|
123
|
+
id: string;
|
|
124
|
+
defaultMessage: string;
|
|
125
|
+
description: string;
|
|
126
|
+
};
|
|
127
|
+
'wizard.step1.users.placeholder': {
|
|
128
|
+
id: string;
|
|
129
|
+
defaultMessage: string;
|
|
130
|
+
description: string;
|
|
131
|
+
};
|
|
132
|
+
'wizard.step1.users.hint': {
|
|
133
|
+
id: string;
|
|
134
|
+
defaultMessage: string;
|
|
135
|
+
description: string;
|
|
136
|
+
};
|
|
137
|
+
'wizard.step1.users.invalid': {
|
|
138
|
+
id: string;
|
|
139
|
+
defaultMessage: string;
|
|
140
|
+
description: string;
|
|
141
|
+
};
|
|
142
|
+
'wizard.step1.roles.heading': {
|
|
143
|
+
id: string;
|
|
144
|
+
defaultMessage: string;
|
|
145
|
+
description: string;
|
|
146
|
+
};
|
|
147
|
+
'wizard.step1.roles.contextLabel.library': {
|
|
148
|
+
id: string;
|
|
149
|
+
defaultMessage: string;
|
|
150
|
+
description: string;
|
|
151
|
+
};
|
|
152
|
+
'wizard.step1.roles.contextLabel.course': {
|
|
153
|
+
id: string;
|
|
154
|
+
defaultMessage: string;
|
|
155
|
+
description: string;
|
|
156
|
+
};
|
|
157
|
+
'wizard.step1.roles.disabled.tooltip': {
|
|
158
|
+
id: string;
|
|
159
|
+
defaultMessage: string;
|
|
160
|
+
description: string;
|
|
161
|
+
};
|
|
162
|
+
'wizard.step2.contextLabel.course': {
|
|
163
|
+
id: string;
|
|
164
|
+
defaultMessage: string;
|
|
165
|
+
description: string;
|
|
166
|
+
};
|
|
167
|
+
'wizard.step2.contextLabel.library': {
|
|
168
|
+
id: string;
|
|
169
|
+
defaultMessage: string;
|
|
170
|
+
description: string;
|
|
171
|
+
};
|
|
172
|
+
'wizard.step2.contextLabel.default': {
|
|
173
|
+
id: string;
|
|
174
|
+
defaultMessage: string;
|
|
175
|
+
description: string;
|
|
176
|
+
};
|
|
177
|
+
'wizard.step2.scope.aggregate.description.course': {
|
|
178
|
+
id: string;
|
|
179
|
+
defaultMessage: string;
|
|
180
|
+
description: string;
|
|
181
|
+
};
|
|
182
|
+
'wizard.step2.scope.aggregate.description.library': {
|
|
183
|
+
id: string;
|
|
184
|
+
defaultMessage: string;
|
|
185
|
+
description: string;
|
|
186
|
+
};
|
|
187
|
+
'wizard.step2.scope.aggregate.platform.label.course': {
|
|
188
|
+
id: string;
|
|
189
|
+
defaultMessage: string;
|
|
190
|
+
description: string;
|
|
191
|
+
};
|
|
192
|
+
'wizard.step2.scope.aggregate.platform.label.library': {
|
|
193
|
+
id: string;
|
|
194
|
+
defaultMessage: string;
|
|
195
|
+
description: string;
|
|
196
|
+
};
|
|
197
|
+
'wizard.step2.scopeList.orgLabel': {
|
|
198
|
+
id: string;
|
|
199
|
+
defaultMessage: string;
|
|
200
|
+
description: string;
|
|
201
|
+
};
|
|
202
|
+
'wizard.step2.scopeList.aggregate.label.course': {
|
|
203
|
+
id: string;
|
|
204
|
+
defaultMessage: string;
|
|
205
|
+
description: string;
|
|
206
|
+
};
|
|
207
|
+
'wizard.step2.scopeList.aggregate.label.library': {
|
|
208
|
+
id: string;
|
|
209
|
+
defaultMessage: string;
|
|
210
|
+
description: string;
|
|
211
|
+
};
|
|
212
|
+
'wizard.step2.scopeList.loading': {
|
|
213
|
+
id: string;
|
|
214
|
+
defaultMessage: string;
|
|
215
|
+
description: string;
|
|
216
|
+
};
|
|
217
|
+
'wizard.step2.scopeList.loadingMore': {
|
|
218
|
+
id: string;
|
|
219
|
+
defaultMessage: string;
|
|
220
|
+
description: string;
|
|
221
|
+
};
|
|
222
|
+
'wizard.step2.scopeList.empty': {
|
|
223
|
+
id: string;
|
|
224
|
+
defaultMessage: string;
|
|
225
|
+
description: string;
|
|
226
|
+
};
|
|
227
|
+
'wizard.step1.docs.heading': {
|
|
228
|
+
id: string;
|
|
229
|
+
defaultMessage: string;
|
|
230
|
+
description: string;
|
|
231
|
+
};
|
|
232
|
+
'wizard.step1.docs.body': {
|
|
233
|
+
id: string;
|
|
234
|
+
defaultMessage: string;
|
|
235
|
+
description: string;
|
|
236
|
+
};
|
|
237
|
+
'wizard.step1.docs.link': {
|
|
238
|
+
id: string;
|
|
239
|
+
defaultMessage: string;
|
|
240
|
+
description: string;
|
|
241
|
+
};
|
|
242
|
+
};
|
|
243
|
+
export default messages;
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { defineMessages } from '@openedx/frontend-base';
|
|
2
|
+
const messages = defineMessages({
|
|
3
|
+
// AssignRoleWizardPage
|
|
4
|
+
'wizard.page.breadcrumb': {
|
|
5
|
+
id: 'wizard.page.breadcrumb',
|
|
6
|
+
defaultMessage: 'Roles and Permissions Management',
|
|
7
|
+
description: 'Breadcrumb label linking back to the team manager page',
|
|
8
|
+
},
|
|
9
|
+
'wizard.page.title': {
|
|
10
|
+
id: 'wizard.page.title',
|
|
11
|
+
defaultMessage: 'Assign Role',
|
|
12
|
+
description: 'Page title for the assign role wizard page',
|
|
13
|
+
},
|
|
14
|
+
// AssignRoleWizard — step titles
|
|
15
|
+
'wizard.step.selectUsersAndRole.error': {
|
|
16
|
+
id: 'wizard.step.selectUsersAndRole.error',
|
|
17
|
+
defaultMessage: 'Error',
|
|
18
|
+
description: 'Error description shown on step 1 header when there are invalid users',
|
|
19
|
+
},
|
|
20
|
+
'wizard.step.selectUsersAndRole.title': {
|
|
21
|
+
id: 'wizard.step.selectUsersAndRole.title',
|
|
22
|
+
defaultMessage: 'Who and Role',
|
|
23
|
+
description: 'Step 1 title in the assign role wizard',
|
|
24
|
+
},
|
|
25
|
+
'wizard.step.defineScope.title': {
|
|
26
|
+
id: 'wizard.step.defineScope.title',
|
|
27
|
+
defaultMessage: 'Where It Applies',
|
|
28
|
+
description: 'Step 2 title in the assign role wizard',
|
|
29
|
+
},
|
|
30
|
+
// AssignRoleWizard — action buttons
|
|
31
|
+
'wizard.button.cancel': {
|
|
32
|
+
id: 'wizard.button.cancel',
|
|
33
|
+
defaultMessage: 'Cancel',
|
|
34
|
+
description: 'Cancel button label in the wizard',
|
|
35
|
+
},
|
|
36
|
+
'wizard.button.back': {
|
|
37
|
+
id: 'wizard.button.back',
|
|
38
|
+
defaultMessage: 'Back',
|
|
39
|
+
description: 'Back button label in the wizard',
|
|
40
|
+
},
|
|
41
|
+
'wizard.button.next': {
|
|
42
|
+
id: 'wizard.button.next',
|
|
43
|
+
defaultMessage: 'Next',
|
|
44
|
+
description: 'Next button label in the wizard',
|
|
45
|
+
},
|
|
46
|
+
'wizard.button.next.pending': {
|
|
47
|
+
id: 'wizard.button.next.pending',
|
|
48
|
+
defaultMessage: 'Validating',
|
|
49
|
+
description: 'Next button label while user validation is in progress',
|
|
50
|
+
},
|
|
51
|
+
'wizard.button.save': {
|
|
52
|
+
id: 'wizard.button.save',
|
|
53
|
+
defaultMessage: 'Save',
|
|
54
|
+
description: 'Save button label in the wizard',
|
|
55
|
+
},
|
|
56
|
+
'wizard.button.save.pending': {
|
|
57
|
+
id: 'wizard.button.save.pending',
|
|
58
|
+
defaultMessage: 'Saving',
|
|
59
|
+
description: 'Save button label while the save operation is in progress',
|
|
60
|
+
},
|
|
61
|
+
// AssignRoleWizard — messages
|
|
62
|
+
'wizard.save.success': {
|
|
63
|
+
id: 'wizard.save.success',
|
|
64
|
+
defaultMessage: 'Role assigned successfully.',
|
|
65
|
+
description: 'Toast message shown when a role is successfully assigned',
|
|
66
|
+
},
|
|
67
|
+
'wizard.save.errors.summary': {
|
|
68
|
+
id: 'wizard.save.errors.summary',
|
|
69
|
+
defaultMessage: 'Some assignments could not be completed. See details above.',
|
|
70
|
+
description: 'Short toast message shown when one or more role assignments fail',
|
|
71
|
+
},
|
|
72
|
+
'wizard.step2.errors.alert.title': {
|
|
73
|
+
id: 'wizard.step2.errors.alert.title',
|
|
74
|
+
defaultMessage: 'The following errors occurred:',
|
|
75
|
+
description: 'Heading of the inline error alert shown in step 2 when role assignments partially fail',
|
|
76
|
+
},
|
|
77
|
+
'wizard.save.error.user_already_has_role': {
|
|
78
|
+
id: 'wizard.save.error.user_already_has_role',
|
|
79
|
+
defaultMessage: '{userIdentifier} already has this role in {scope}',
|
|
80
|
+
description: 'Error shown in the toast when the user already holds the role in the selected scope',
|
|
81
|
+
},
|
|
82
|
+
'wizard.save.error.user_not_found': {
|
|
83
|
+
id: 'wizard.save.error.user_not_found',
|
|
84
|
+
defaultMessage: 'User "{userIdentifier}" was not found',
|
|
85
|
+
description: 'Error shown in the toast when the username or email does not match any account',
|
|
86
|
+
},
|
|
87
|
+
'wizard.save.error.role_assignment_error': {
|
|
88
|
+
id: 'wizard.save.error.role_assignment_error',
|
|
89
|
+
defaultMessage: 'Could not assign role to {userIdentifier} in {scope}',
|
|
90
|
+
description: 'Error shown in the toast when an unexpected error occurs during role assignment',
|
|
91
|
+
},
|
|
92
|
+
'wizard.save.error.default': {
|
|
93
|
+
id: 'wizard.save.error.default',
|
|
94
|
+
defaultMessage: '{userIdentifier} ({scope}): {error}',
|
|
95
|
+
description: 'Fallback error line shown in the toast for unknown role-assignment error codes',
|
|
96
|
+
},
|
|
97
|
+
// DefineApplicationScopeStep — filter bar
|
|
98
|
+
'wizard.step2.search.placeholder': {
|
|
99
|
+
id: 'wizard.step2.search.placeholder',
|
|
100
|
+
defaultMessage: 'Search',
|
|
101
|
+
description: 'Placeholder text for the scope search input in step 2',
|
|
102
|
+
},
|
|
103
|
+
'wizard.step2.filter.org.label': {
|
|
104
|
+
id: 'wizard.step2.filter.org.label',
|
|
105
|
+
defaultMessage: 'Organization',
|
|
106
|
+
description: 'Default label for the organization filter dropdown in step 2',
|
|
107
|
+
},
|
|
108
|
+
'wizard.step2.filter.org.all': {
|
|
109
|
+
id: 'wizard.step2.filter.org.all',
|
|
110
|
+
defaultMessage: 'All Organizations',
|
|
111
|
+
description: 'Option to clear the organization filter in step 2',
|
|
112
|
+
},
|
|
113
|
+
'wizard.step2.filter.applied': {
|
|
114
|
+
id: 'wizard.step2.filter.applied',
|
|
115
|
+
defaultMessage: 'Filter applied:',
|
|
116
|
+
description: 'Label prefix shown before the active context-type filter badge in step 2',
|
|
117
|
+
},
|
|
118
|
+
'wizard.step2.count': {
|
|
119
|
+
id: 'wizard.step2.count',
|
|
120
|
+
defaultMessage: 'Showing {shown} of {total}.',
|
|
121
|
+
description: 'Count of visible scopes vs total in step 2',
|
|
122
|
+
},
|
|
123
|
+
// SelectUsersAndRoleStep — users section
|
|
124
|
+
'wizard.step1.users.heading': {
|
|
125
|
+
id: 'wizard.step1.users.heading',
|
|
126
|
+
defaultMessage: 'Users',
|
|
127
|
+
description: 'Heading for the users input section in step 1',
|
|
128
|
+
},
|
|
129
|
+
'wizard.step1.users.label': {
|
|
130
|
+
id: 'wizard.step1.users.label',
|
|
131
|
+
defaultMessage: 'Add users by username or email',
|
|
132
|
+
description: 'Label for the users textarea in step 1',
|
|
133
|
+
},
|
|
134
|
+
'wizard.step1.users.placeholder': {
|
|
135
|
+
id: 'wizard.step1.users.placeholder',
|
|
136
|
+
defaultMessage: 'Enter one or more email addresses or usernames',
|
|
137
|
+
description: 'Placeholder text for the users textarea',
|
|
138
|
+
},
|
|
139
|
+
'wizard.step1.users.hint': {
|
|
140
|
+
id: 'wizard.step1.users.hint',
|
|
141
|
+
defaultMessage: 'The user must already have an account.',
|
|
142
|
+
description: 'Hint text below the users textarea',
|
|
143
|
+
},
|
|
144
|
+
'wizard.step1.users.invalid': {
|
|
145
|
+
id: 'wizard.step1.users.invalid',
|
|
146
|
+
defaultMessage: '{count, plural, one {This email/username is not associated with an account in this platform.} other {Some of these emails or usernames are not associated with accounts in this platform.}}',
|
|
147
|
+
description: 'Error shown when one or more entered users are invalid',
|
|
148
|
+
},
|
|
149
|
+
// SelectUsersAndRoleStep — roles section
|
|
150
|
+
'wizard.step1.roles.heading': {
|
|
151
|
+
id: 'wizard.step1.roles.heading',
|
|
152
|
+
defaultMessage: 'Roles',
|
|
153
|
+
description: 'Heading for the roles selection section in step 1',
|
|
154
|
+
},
|
|
155
|
+
'wizard.step1.roles.contextLabel.library': {
|
|
156
|
+
id: 'wizard.step1.roles.contextLabel.library',
|
|
157
|
+
defaultMessage: 'Libraries',
|
|
158
|
+
description: 'Label for the library roles group',
|
|
159
|
+
},
|
|
160
|
+
'wizard.step1.roles.contextLabel.course': {
|
|
161
|
+
id: 'wizard.step1.roles.contextLabel.course',
|
|
162
|
+
defaultMessage: 'Courses',
|
|
163
|
+
description: 'Label for the course roles group',
|
|
164
|
+
},
|
|
165
|
+
'wizard.step1.roles.disabled.tooltip': {
|
|
166
|
+
id: 'wizard.step1.roles.disabled.tooltip',
|
|
167
|
+
defaultMessage: 'We are expanding our permissions system. This role is currently unavailable but will be part of an upcoming update.',
|
|
168
|
+
description: 'Tooltip shown on disabled role options',
|
|
169
|
+
},
|
|
170
|
+
// DefineApplicationScopeStep — context labels
|
|
171
|
+
'wizard.step2.contextLabel.course': {
|
|
172
|
+
id: 'wizard.step2.contextLabel.course',
|
|
173
|
+
defaultMessage: 'Courses',
|
|
174
|
+
description: 'Context label shown in the scope filter bar when the selected role applies to courses',
|
|
175
|
+
},
|
|
176
|
+
'wizard.step2.contextLabel.library': {
|
|
177
|
+
id: 'wizard.step2.contextLabel.library',
|
|
178
|
+
defaultMessage: 'Libraries',
|
|
179
|
+
description: 'Context label shown in the scope filter bar when the selected role applies to libraries',
|
|
180
|
+
},
|
|
181
|
+
'wizard.step2.contextLabel.default': {
|
|
182
|
+
id: 'wizard.step2.contextLabel.default',
|
|
183
|
+
defaultMessage: 'Items',
|
|
184
|
+
description: 'Fallback context label shown in the scope filter bar when no specific context type is matched',
|
|
185
|
+
},
|
|
186
|
+
// useScopeListData — platform/org aggregate scope items
|
|
187
|
+
'wizard.step2.scope.aggregate.description.course': {
|
|
188
|
+
id: 'wizard.step2.scope.aggregate.description.course',
|
|
189
|
+
defaultMessage: 'Includes current and future courses',
|
|
190
|
+
description: 'Description for the platform-wide aggregate scope item when context type is course',
|
|
191
|
+
},
|
|
192
|
+
'wizard.step2.scope.aggregate.description.library': {
|
|
193
|
+
id: 'wizard.step2.scope.aggregate.description.library',
|
|
194
|
+
defaultMessage: 'Includes current and future libraries',
|
|
195
|
+
description: 'Description for the platform-wide aggregate scope item when context type is library',
|
|
196
|
+
},
|
|
197
|
+
'wizard.step2.scope.aggregate.platform.label.course': {
|
|
198
|
+
id: 'wizard.step2.scope.aggregate.platform.label.course',
|
|
199
|
+
defaultMessage: 'All courses on the platform',
|
|
200
|
+
description: 'Display name for the platform-wide aggregate scope item when context type is course',
|
|
201
|
+
},
|
|
202
|
+
'wizard.step2.scope.aggregate.platform.label.library': {
|
|
203
|
+
id: 'wizard.step2.scope.aggregate.platform.label.library',
|
|
204
|
+
defaultMessage: 'All libraries on the platform',
|
|
205
|
+
description: 'Display name for the platform-wide aggregate scope item when context type is library',
|
|
206
|
+
},
|
|
207
|
+
// ScopeList — org section header
|
|
208
|
+
'wizard.step2.scopeList.orgLabel': {
|
|
209
|
+
id: 'wizard.step2.scopeList.orgLabel',
|
|
210
|
+
defaultMessage: 'Org: {orgName}',
|
|
211
|
+
description: 'Label for the collapsible org section header in the scope list',
|
|
212
|
+
},
|
|
213
|
+
// ScopeList — org-level aggregate scope items
|
|
214
|
+
'wizard.step2.scopeList.aggregate.label.course': {
|
|
215
|
+
id: 'wizard.step2.scopeList.aggregate.label.course',
|
|
216
|
+
defaultMessage: 'All courses in this organization',
|
|
217
|
+
description: 'Display name for the org-wide aggregate scope item when context type is course',
|
|
218
|
+
},
|
|
219
|
+
'wizard.step2.scopeList.aggregate.label.library': {
|
|
220
|
+
id: 'wizard.step2.scopeList.aggregate.label.library',
|
|
221
|
+
defaultMessage: 'All libraries in this organization',
|
|
222
|
+
description: 'Display name for the org-wide aggregate scope item when context type is library',
|
|
223
|
+
},
|
|
224
|
+
// ScopeList — loading / empty states
|
|
225
|
+
'wizard.step2.scopeList.loading': {
|
|
226
|
+
id: 'wizard.step2.scopeList.loading',
|
|
227
|
+
defaultMessage: 'Loading scopes...',
|
|
228
|
+
description: 'Screen reader text for the loading spinner while scopes are being fetched',
|
|
229
|
+
},
|
|
230
|
+
'wizard.step2.scopeList.loadingMore': {
|
|
231
|
+
id: 'wizard.step2.scopeList.loadingMore',
|
|
232
|
+
defaultMessage: 'Loading more...',
|
|
233
|
+
description: 'Screen reader text for the spinner shown while fetching the next page of scopes',
|
|
234
|
+
},
|
|
235
|
+
'wizard.step2.scopeList.empty': {
|
|
236
|
+
id: 'wizard.step2.scopeList.empty',
|
|
237
|
+
defaultMessage: 'No scopes found.',
|
|
238
|
+
description: 'Message shown when no scopes match the current filters',
|
|
239
|
+
},
|
|
240
|
+
// SelectUsersAndRoleStep — documentation link
|
|
241
|
+
'wizard.step1.docs.heading': {
|
|
242
|
+
id: 'wizard.step1.docs.heading',
|
|
243
|
+
defaultMessage: "Can't find the role you want to assign?",
|
|
244
|
+
description: 'Heading for the documentation link at the bottom of step 1',
|
|
245
|
+
},
|
|
246
|
+
'wizard.step1.docs.body': {
|
|
247
|
+
id: 'wizard.step1.docs.body',
|
|
248
|
+
defaultMessage: 'Some roles are managed outside this console',
|
|
249
|
+
description: 'Text accompanying the external documentation link',
|
|
250
|
+
},
|
|
251
|
+
'wizard.step1.docs.link': {
|
|
252
|
+
id: 'wizard.step1.docs.link',
|
|
253
|
+
defaultMessage: 'View roles managed in LMS and Django Admin',
|
|
254
|
+
description: 'Link text pointing to LMS and Django Admin role management',
|
|
255
|
+
},
|
|
256
|
+
});
|
|
257
|
+
export default messages;
|
|
258
|
+
//# sourceMappingURL=messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../../src/authz-module/role-assignation-wizard/messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,MAAM,QAAQ,GAAG,cAAc,CAAC;IAC9B,uBAAuB;IACvB,wBAAwB,EAAE;QACxB,EAAE,EAAE,wBAAwB;QAC5B,cAAc,EAAE,kCAAkC;QAClD,WAAW,EAAE,wDAAwD;KACtE;IACD,mBAAmB,EAAE;QACnB,EAAE,EAAE,mBAAmB;QACvB,cAAc,EAAE,aAAa;QAC7B,WAAW,EAAE,4CAA4C;KAC1D;IAED,iCAAiC;IACjC,sCAAsC,EAAE;QACtC,EAAE,EAAE,sCAAsC;QAC1C,cAAc,EAAE,OAAO;QACvB,WAAW,EAAE,uEAAuE;KACrF;IACD,sCAAsC,EAAE;QACtC,EAAE,EAAE,sCAAsC;QAC1C,cAAc,EAAE,cAAc;QAC9B,WAAW,EAAE,wCAAwC;KACtD;IACD,+BAA+B,EAAE;QAC/B,EAAE,EAAE,+BAA+B;QACnC,cAAc,EAAE,kBAAkB;QAClC,WAAW,EAAE,wCAAwC;KACtD;IAED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AAiC,EAAE;QACjC,EAAE,EAAE,iCAAiC;QACrC,cAAc,EAAE,gBAAgB;QAChC,WAAW,EAAE,gEAAgE;KAC9E;IAED,8CAA8C;IAC9C,+CAA+C,EAAE;QAC/C,EAAE,EAAE,+CAA+C;QACnD,cAAc,EAAE,kCAAkC;QAClD,WAAW,EAAE,gFAAgF;KAC9F;IACD,gDAAgD,EAAE;QAChD,EAAE,EAAE,gDAAgD;QACpD,cAAc,EAAE,oCAAoC;QACpD,WAAW,EAAE,iFAAiF;KAC/F;IAED,qCAAqC;IACrC,gCAAgC,EAAE;QAChC,EAAE,EAAE,gCAAgC;QACpC,cAAc,EAAE,mBAAmB;QACnC,WAAW,EAAE,2EAA2E;KACzF;IACD,oCAAoC,EAAE;QACpC,EAAE,EAAE,oCAAoC;QACxC,cAAc,EAAE,iBAAiB;QACjC,WAAW,EAAE,iFAAiF;KAC/F;IACD,8BAA8B,EAAE;QAC9B,EAAE,EAAE,8BAA8B;QAClC,cAAc,EAAE,kBAAkB;QAClC,WAAW,EAAE,wDAAwD;KACtE;IAED,8CAA8C;IAC9C,2BAA2B,EAAE;QAC3B,EAAE,EAAE,2BAA2B;QAC/B,cAAc,EAAE,yCAAyC;QACzD,WAAW,EAAE,4DAA4D;KAC1E;IACD,wBAAwB,EAAE;QACxB,EAAE,EAAE,wBAAwB;QAC5B,cAAc,EAAE,6CAA6C;QAC7D,WAAW,EAAE,mDAAmD;KACjE;IACD,wBAAwB,EAAE;QACxB,EAAE,EAAE,wBAAwB;QAC5B,cAAc,EAAE,4CAA4C;QAC5D,WAAW,EAAE,4DAA4D;KAC1E;CACF,CAAC,CAAC;AAEH,eAAe,QAAQ,CAAC","sourcesContent":["import { defineMessages } from '@openedx/frontend-base';\n\nconst messages = defineMessages({\n // AssignRoleWizardPage\n 'wizard.page.breadcrumb': {\n id: 'wizard.page.breadcrumb',\n defaultMessage: 'Roles and Permissions Management',\n description: 'Breadcrumb label linking back to the team manager page',\n },\n 'wizard.page.title': {\n id: 'wizard.page.title',\n defaultMessage: 'Assign Role',\n description: 'Page title for the assign role wizard page',\n },\n\n // AssignRoleWizard — step titles\n 'wizard.step.selectUsersAndRole.error': {\n id: 'wizard.step.selectUsersAndRole.error',\n defaultMessage: 'Error',\n description: 'Error description shown on step 1 header when there are invalid users',\n },\n 'wizard.step.selectUsersAndRole.title': {\n id: 'wizard.step.selectUsersAndRole.title',\n defaultMessage: 'Who and Role',\n description: 'Step 1 title in the assign role wizard',\n },\n 'wizard.step.defineScope.title': {\n id: 'wizard.step.defineScope.title',\n defaultMessage: 'Where It Applies',\n description: 'Step 2 title in the assign role wizard',\n },\n\n // AssignRoleWizard — action buttons\n 'wizard.button.cancel': {\n id: 'wizard.button.cancel',\n defaultMessage: 'Cancel',\n description: 'Cancel button label in the wizard',\n },\n 'wizard.button.back': {\n id: 'wizard.button.back',\n defaultMessage: 'Back',\n description: 'Back button label in the wizard',\n },\n 'wizard.button.next': {\n id: 'wizard.button.next',\n defaultMessage: 'Next',\n description: 'Next button label in the wizard',\n },\n 'wizard.button.next.pending': {\n id: 'wizard.button.next.pending',\n defaultMessage: 'Validating',\n description: 'Next button label while user validation is in progress',\n },\n 'wizard.button.save': {\n id: 'wizard.button.save',\n defaultMessage: 'Save',\n description: 'Save button label in the wizard',\n },\n 'wizard.button.save.pending': {\n id: 'wizard.button.save.pending',\n defaultMessage: 'Saving',\n description: 'Save button label while the save operation is in progress',\n },\n\n // AssignRoleWizard — messages\n 'wizard.save.success': {\n id: 'wizard.save.success',\n defaultMessage: 'Role assigned successfully.',\n description: 'Toast message shown when a role is successfully assigned',\n },\n 'wizard.save.errors.summary': {\n id: 'wizard.save.errors.summary',\n defaultMessage: 'Some assignments could not be completed. See details above.',\n description: 'Short toast message shown when one or more role assignments fail',\n },\n 'wizard.step2.errors.alert.title': {\n id: 'wizard.step2.errors.alert.title',\n defaultMessage: 'The following errors occurred:',\n description: 'Heading of the inline error alert shown in step 2 when role assignments partially fail',\n },\n 'wizard.save.error.user_already_has_role': {\n id: 'wizard.save.error.user_already_has_role',\n defaultMessage: '{userIdentifier} already has this role in {scope}',\n description: 'Error shown in the toast when the user already holds the role in the selected scope',\n },\n 'wizard.save.error.user_not_found': {\n id: 'wizard.save.error.user_not_found',\n defaultMessage: 'User \"{userIdentifier}\" was not found',\n description: 'Error shown in the toast when the username or email does not match any account',\n },\n 'wizard.save.error.role_assignment_error': {\n id: 'wizard.save.error.role_assignment_error',\n defaultMessage: 'Could not assign role to {userIdentifier} in {scope}',\n description: 'Error shown in the toast when an unexpected error occurs during role assignment',\n },\n 'wizard.save.error.default': {\n id: 'wizard.save.error.default',\n defaultMessage: '{userIdentifier} ({scope}): {error}',\n description: 'Fallback error line shown in the toast for unknown role-assignment error codes',\n },\n\n // DefineApplicationScopeStep — filter bar\n 'wizard.step2.search.placeholder': {\n id: 'wizard.step2.search.placeholder',\n defaultMessage: 'Search',\n description: 'Placeholder text for the scope search input in step 2',\n },\n 'wizard.step2.filter.org.label': {\n id: 'wizard.step2.filter.org.label',\n defaultMessage: 'Organization',\n description: 'Default label for the organization filter dropdown in step 2',\n },\n 'wizard.step2.filter.org.all': {\n id: 'wizard.step2.filter.org.all',\n defaultMessage: 'All Organizations',\n description: 'Option to clear the organization filter in step 2',\n },\n 'wizard.step2.filter.applied': {\n id: 'wizard.step2.filter.applied',\n defaultMessage: 'Filter applied:',\n description: 'Label prefix shown before the active context-type filter badge in step 2',\n },\n 'wizard.step2.count': {\n id: 'wizard.step2.count',\n defaultMessage: 'Showing {shown} of {total}.',\n description: 'Count of visible scopes vs total in step 2',\n },\n\n // SelectUsersAndRoleStep — users section\n 'wizard.step1.users.heading': {\n id: 'wizard.step1.users.heading',\n defaultMessage: 'Users',\n description: 'Heading for the users input section in step 1',\n },\n 'wizard.step1.users.label': {\n id: 'wizard.step1.users.label',\n defaultMessage: 'Add users by username or email',\n description: 'Label for the users textarea in step 1',\n },\n 'wizard.step1.users.placeholder': {\n id: 'wizard.step1.users.placeholder',\n defaultMessage: 'Enter one or more email addresses or usernames',\n description: 'Placeholder text for the users textarea',\n },\n 'wizard.step1.users.hint': {\n id: 'wizard.step1.users.hint',\n defaultMessage: 'The user must already have an account.',\n description: 'Hint text below the users textarea',\n },\n 'wizard.step1.users.invalid': {\n id: 'wizard.step1.users.invalid',\n defaultMessage: '{count, plural, one {This email/username is not associated with an account in this platform.} other {Some of these emails or usernames are not associated with accounts in this platform.}}',\n description: 'Error shown when one or more entered users are invalid',\n },\n\n // SelectUsersAndRoleStep — roles section\n 'wizard.step1.roles.heading': {\n id: 'wizard.step1.roles.heading',\n defaultMessage: 'Roles',\n description: 'Heading for the roles selection section in step 1',\n },\n 'wizard.step1.roles.contextLabel.library': {\n id: 'wizard.step1.roles.contextLabel.library',\n defaultMessage: 'Libraries',\n description: 'Label for the library roles group',\n },\n 'wizard.step1.roles.contextLabel.course': {\n id: 'wizard.step1.roles.contextLabel.course',\n defaultMessage: 'Courses',\n description: 'Label for the course roles group',\n },\n 'wizard.step1.roles.disabled.tooltip': {\n id: 'wizard.step1.roles.disabled.tooltip',\n defaultMessage: 'We are expanding our permissions system. This role is currently unavailable but will be part of an upcoming update.',\n description: 'Tooltip shown on disabled role options',\n },\n\n // DefineApplicationScopeStep — context labels\n 'wizard.step2.contextLabel.course': {\n id: 'wizard.step2.contextLabel.course',\n defaultMessage: 'Courses',\n description: 'Context label shown in the scope filter bar when the selected role applies to courses',\n },\n 'wizard.step2.contextLabel.library': {\n id: 'wizard.step2.contextLabel.library',\n defaultMessage: 'Libraries',\n description: 'Context label shown in the scope filter bar when the selected role applies to libraries',\n },\n 'wizard.step2.contextLabel.default': {\n id: 'wizard.step2.contextLabel.default',\n defaultMessage: 'Items',\n description: 'Fallback context label shown in the scope filter bar when no specific context type is matched',\n },\n\n // useScopeListData — platform/org aggregate scope items\n 'wizard.step2.scope.aggregate.description.course': {\n id: 'wizard.step2.scope.aggregate.description.course',\n defaultMessage: 'Includes current and future courses',\n description: 'Description for the platform-wide aggregate scope item when context type is course',\n },\n 'wizard.step2.scope.aggregate.description.library': {\n id: 'wizard.step2.scope.aggregate.description.library',\n defaultMessage: 'Includes current and future libraries',\n description: 'Description for the platform-wide aggregate scope item when context type is library',\n },\n 'wizard.step2.scope.aggregate.platform.label.course': {\n id: 'wizard.step2.scope.aggregate.platform.label.course',\n defaultMessage: 'All courses on the platform',\n description: 'Display name for the platform-wide aggregate scope item when context type is course',\n },\n 'wizard.step2.scope.aggregate.platform.label.library': {\n id: 'wizard.step2.scope.aggregate.platform.label.library',\n defaultMessage: 'All libraries on the platform',\n description: 'Display name for the platform-wide aggregate scope item when context type is library',\n },\n\n // ScopeList — org section header\n 'wizard.step2.scopeList.orgLabel': {\n id: 'wizard.step2.scopeList.orgLabel',\n defaultMessage: 'Org: {orgName}',\n description: 'Label for the collapsible org section header in the scope list',\n },\n\n // ScopeList — org-level aggregate scope items\n 'wizard.step2.scopeList.aggregate.label.course': {\n id: 'wizard.step2.scopeList.aggregate.label.course',\n defaultMessage: 'All courses in this organization',\n description: 'Display name for the org-wide aggregate scope item when context type is course',\n },\n 'wizard.step2.scopeList.aggregate.label.library': {\n id: 'wizard.step2.scopeList.aggregate.label.library',\n defaultMessage: 'All libraries in this organization',\n description: 'Display name for the org-wide aggregate scope item when context type is library',\n },\n\n // ScopeList — loading / empty states\n 'wizard.step2.scopeList.loading': {\n id: 'wizard.step2.scopeList.loading',\n defaultMessage: 'Loading scopes...',\n description: 'Screen reader text for the loading spinner while scopes are being fetched',\n },\n 'wizard.step2.scopeList.loadingMore': {\n id: 'wizard.step2.scopeList.loadingMore',\n defaultMessage: 'Loading more...',\n description: 'Screen reader text for the spinner shown while fetching the next page of scopes',\n },\n 'wizard.step2.scopeList.empty': {\n id: 'wizard.step2.scopeList.empty',\n defaultMessage: 'No scopes found.',\n description: 'Message shown when no scopes match the current filters',\n },\n\n // SelectUsersAndRoleStep — documentation link\n 'wizard.step1.docs.heading': {\n id: 'wizard.step1.docs.heading',\n defaultMessage: \"Can't find the role you want to assign?\",\n description: 'Heading for the documentation link at the bottom of step 1',\n },\n 'wizard.step1.docs.body': {\n id: 'wizard.step1.docs.body',\n defaultMessage: 'Some roles are managed outside this console',\n description: 'Text accompanying the external documentation link',\n },\n 'wizard.step1.docs.link': {\n id: 'wizard.step1.docs.link',\n defaultMessage: 'View roles managed in LMS and Django Admin',\n description: 'Link text pointing to LMS and Django Admin role management',\n },\n});\n\nexport default messages;\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { IntlShape } from '@openedx/frontend-base';
|
|
2
|
+
import { PutAssignTeamMembersRoleResponse } from '../data/api';
|
|
3
|
+
type RoleAssignmentError = PutAssignTeamMembersRoleResponse['errors'][number];
|
|
4
|
+
export declare const formatRoleAssignmentError: (intl: IntlShape, e: RoleAssignmentError) => string;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ROLE_ASSIGNMENT_ERRORS } from './constants';
|
|
2
|
+
import messages from './messages';
|
|
3
|
+
export const formatRoleAssignmentError = (intl, e) => {
|
|
4
|
+
const params = { userIdentifier: e.userIdentifier, scope: e.scope };
|
|
5
|
+
if (e.error === ROLE_ASSIGNMENT_ERRORS.USER_ALREADY_HAS_ROLE) {
|
|
6
|
+
return intl.formatMessage(messages['wizard.save.error.user_already_has_role'], params);
|
|
7
|
+
}
|
|
8
|
+
if (e.error === ROLE_ASSIGNMENT_ERRORS.USER_NOT_FOUND) {
|
|
9
|
+
return intl.formatMessage(messages['wizard.save.error.user_not_found'], params);
|
|
10
|
+
}
|
|
11
|
+
if (e.error === ROLE_ASSIGNMENT_ERRORS.ROLE_ASSIGNMENT_ERROR) {
|
|
12
|
+
return intl.formatMessage(messages['wizard.save.error.role_assignment_error'], params);
|
|
13
|
+
}
|
|
14
|
+
return intl.formatMessage(messages['wizard.save.error.default'], Object.assign(Object.assign({}, params), { error: e.error }));
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/authz-module/role-assignation-wizard/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,QAAQ,MAAM,YAAY,CAAC;AAIlC,MAAM,CAAC,MAAM,yBAAyB,GAAG,CACvC,IAAe,EACf,CAAsB,EACd,EAAE;IACV,MAAM,MAAM,GAAG,EAAE,cAAc,EAAE,CAAC,CAAC,cAAc,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC;IACpE,IAAI,CAAC,CAAC,KAAK,KAAK,sBAAsB,CAAC,qBAAqB,EAAE,CAAC;QAC7D,OAAO,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,yCAAyC,CAAC,EAAE,MAAM,CAAC,CAAC;IACzF,CAAC;IACD,IAAI,CAAC,CAAC,KAAK,KAAK,sBAAsB,CAAC,cAAc,EAAE,CAAC;QACtD,OAAO,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,kCAAkC,CAAC,EAAE,MAAM,CAAC,CAAC;IAClF,CAAC;IACD,IAAI,CAAC,CAAC,KAAK,KAAK,sBAAsB,CAAC,qBAAqB,EAAE,CAAC;QAC7D,OAAO,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,yCAAyC,CAAC,EAAE,MAAM,CAAC,CAAC;IACzF,CAAC;IACD,OAAO,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,2BAA2B,CAAC,kCAAO,MAAM,KAAE,KAAK,EAAE,CAAC,CAAC,KAAK,IAAG,CAAC;AAClG,CAAC,CAAC","sourcesContent":["import type { IntlShape } from '@openedx/frontend-base';\nimport { PutAssignTeamMembersRoleResponse } from '@src/authz-module/data/api';\nimport { ROLE_ASSIGNMENT_ERRORS } from './constants';\nimport messages from './messages';\n\ntype RoleAssignmentError = PutAssignTeamMembersRoleResponse['errors'][number];\n\nexport const formatRoleAssignmentError = (\n intl: IntlShape,\n e: RoleAssignmentError,\n): string => {\n const params = { userIdentifier: e.userIdentifier, scope: e.scope };\n if (e.error === ROLE_ASSIGNMENT_ERRORS.USER_ALREADY_HAS_ROLE) {\n return intl.formatMessage(messages['wizard.save.error.user_already_has_role'], params);\n }\n if (e.error === ROLE_ASSIGNMENT_ERRORS.USER_NOT_FOUND) {\n return intl.formatMessage(messages['wizard.save.error.user_not_found'], params);\n }\n if (e.error === ROLE_ASSIGNMENT_ERRORS.ROLE_ASSIGNMENT_ERROR) {\n return intl.formatMessage(messages['wizard.save.error.role_assignment_error'], params);\n }\n return intl.formatMessage(messages['wizard.save.error.default'], { ...params, error: e.error });\n};\n"]}
|