Skip to content

Commit 6984da1

Browse files
feat: roles and permissions button redirect added
1 parent 448fcad commit 6984da1

4 files changed

Lines changed: 31 additions & 1 deletion

File tree

src/header/hooks.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ export const useSettingMenuItems = (courseId: string) => {
9090
href: `/course/${courseId}/settings/grading`,
9191
title: intl.formatMessage(messages['header.links.grading']),
9292
},
93+
{
94+
href: `${getConfig().ADMIN_CONSOLE_URL}/authz?scope=${courseId}`,
95+
title: intl.formatMessage(messages['header.links.roles.permissions']),
96+
},
9397
{
9498
href: `/course/${courseId}/course_team`,
9599
title: intl.formatMessage(messages['header.links.courseTeam']),

src/header/messages.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ const messages = defineMessages({
6161
defaultMessage: 'Grading',
6262
description: 'Link to Studio Grading page',
6363
},
64+
'header.links.roles.permissions': {
65+
id: 'header.links.roles.permissions',
66+
defaultMessage: 'Roles and Permissions',
67+
description: 'Link to Studio Roles and Permissions page',
68+
},
6469
'header.links.courseTeam': {
6570
id: 'header.links.courseTeam',
6671
defaultMessage: 'Course Team',

src/studio-home/StudioHome.tsx

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ import {
77
MailtoLink,
88
Row,
99
} from '@openedx/paragon';
10-
import { Add as AddIcon, Error } from '@openedx/paragon/icons';
10+
import { Add as AddIcon, Error, ManageAccounts } from '@openedx/paragon/icons';
1111
import { useIntl } from '@edx/frontend-platform/i18n';
12+
import { getConfig } from '@edx/frontend-platform';
1213
import { StudioFooterSlot } from '@edx/frontend-component-footer';
1314
import { useLocation, useNavigate } from 'react-router-dom';
1415

@@ -47,6 +48,8 @@ const StudioHome = () => {
4748
librariesV2Enabled,
4849
} = useStudioHome();
4950

51+
const adminConsoleUrl = `${getConfig().ADMIN_CONSOLE_URL}/authz`;
52+
5053
const v1LibraryTab = librariesV1Enabled && location?.pathname.split('/').pop() === 'libraries-v1';
5154
const showV2LibraryURL = librariesV2Enabled && !v1LibraryTab;
5255

@@ -71,6 +74,20 @@ const StudioHome = () => {
7174
);
7275
}
7376

77+
headerButtons.push(
78+
<div className="border-right mr-3 pr-4 py-2">
79+
<Button
80+
as="a"
81+
href={adminConsoleUrl}
82+
variant="primary"
83+
iconBefore={ManageAccounts}
84+
size="sm"
85+
>
86+
{intl.formatMessage(messages.addRolesPermissionsBtnText)}
87+
</Button>
88+
</div>,
89+
);
90+
7491
if (hasAbilityToCreateNewCourse) {
7592
headerButtons.push(
7693
<Button

src/studio-home/messages.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ const messages = defineMessages({
1313
id: 'course-authoring.studio-home.add-new-library.btn.text',
1414
defaultMessage: 'New library',
1515
},
16+
addRolesPermissionsBtnText: {
17+
id: 'course-authoring.studio-home.add-roles-permissions.btn.text',
18+
defaultMessage: 'Roles and permissions',
19+
},
1620
homePageLoadFailedMessage: {
1721
id: 'course-authoring.studio-home.page-load.failed.message',
1822
defaultMessage: 'Failed to load Studio home. Please try again later.',

0 commit comments

Comments
 (0)