only show Maintenance user menu link when the user is an administrator (edX staff) (#27)

This commit is contained in:
Michael Roytman
2020-08-03 15:07:07 -04:00
committed by GitHub
parent 991ab0ac9c
commit a0e26ac339

View File

@@ -29,23 +29,38 @@ function Header({ courseId }) {
},
];
const userMenu = authenticatedUser === null ? [] : [
{
type: 'item',
href: config.STUDIO_BASE_URL,
content: 'Studio Home',
},
{
type: 'item',
href: `${config.STUDIO_BASE_URL}/maintenance`,
content: 'Maintenance',
},
{
type: 'item',
href: config.LOGOUT_URL,
content: 'Sign Out',
},
];
const studioHomeItem = {
type: 'item',
href: config.STUDIO_BASE_URL,
content: 'Studio Home',
};
const logoutItem = {
type: 'item',
href: config.LOGOUT_URL,
content: 'Sign Out',
};
let userMenu = [];
if (authenticatedUser !== null) {
if (authenticatedUser.administrator) {
userMenu = [
studioHomeItem,
{
type: 'item',
href: `${config.STUDIO_BASE_URL}/maintenance`,
content: 'Maintenance',
},
logoutItem,
];
} else {
userMenu = [
studioHomeItem,
logoutItem,
];
}
}
const props = {
logo: StudioLogoPNG,