Remove admin only pages from non-admin menu

This commit is contained in:
Andrew Kingston 2021-05-24 12:44:59 +01:00
parent d7aae52657
commit afd0936fd7
1 changed files with 34 additions and 12 deletions

View File

@ -20,18 +20,40 @@
let userInfoModal let userInfoModal
let changePasswordModal let changePasswordModal
const menu = [ $: menu = buildMenu($auth.isAdmin)
{ title: "Apps", href: "/builder/portal/apps" },
{ title: "Users", href: "/builder/portal/manage/users", heading: "Manage" }, const buildMenu = admin => {
{ title: "Auth", href: "/builder/portal/manage/auth" }, let menu = [{ title: "Apps", href: "/builder/portal/apps" }]
{ title: "Email", href: "/builder/portal/manage/email" }, if (admin) {
{ menu = menu.concat([
title: "Organisation", {
href: "/builder/portal/settings/organisation", title: "Users",
heading: "Settings", href: "/builder/portal/manage/users",
}, heading: "Manage",
{ title: "Theming", href: "/builder/portal/settings/theming" }, },
] { title: "Auth", href: "/builder/portal/manage/auth" },
{ title: "Email", href: "/builder/portal/manage/email" },
{
title: "Organisation",
href: "/builder/portal/settings/organisation",
heading: "Settings",
},
{
title: "Theming",
href: "/builder/portal/settings/theming",
},
])
} else {
menu = menu.concat([
{
title: "Theming",
href: "/builder/portal/settings/theming",
heading: "Settings",
},
])
}
return menu
}
onMount(async () => { onMount(async () => {
// Prevent non-builders from accessing the portal // Prevent non-builders from accessing the portal