Allow developer users to access users, groups and usage pages
This commit is contained in:
parent
1d9ab4163f
commit
e23f7dde47
|
@ -4,35 +4,39 @@ import { admin } from "./admin"
|
|||
import { auth } from "./auth"
|
||||
|
||||
export const menu = derived([admin, auth], ([$admin, $auth]) => {
|
||||
// Standard user and developer pages
|
||||
// Determine user sub pages
|
||||
let userSubPages = [
|
||||
{
|
||||
title: "Users",
|
||||
href: "/builder/portal/users/users",
|
||||
},
|
||||
]
|
||||
if (isEnabled(TENANT_FEATURE_FLAGS.USER_GROUPS)) {
|
||||
userSubPages.push({
|
||||
title: "Groups",
|
||||
href: "/builder/portal/users/groups",
|
||||
})
|
||||
}
|
||||
|
||||
// Pages that all devs and admins can access
|
||||
let menu = [
|
||||
{
|
||||
title: "Apps",
|
||||
href: "/builder/portal/apps",
|
||||
},
|
||||
{
|
||||
title: "Users",
|
||||
href: "/builder/portal/users",
|
||||
subPages: userSubPages,
|
||||
},
|
||||
{
|
||||
title: "Plugins",
|
||||
href: "/builder/portal/plugins",
|
||||
},
|
||||
]
|
||||
|
||||
// Admin only pages
|
||||
// Add settings page for admins
|
||||
if ($auth.isAdmin) {
|
||||
// Determine user sub pages
|
||||
let userSubPages = [
|
||||
{
|
||||
title: "Users",
|
||||
href: "/builder/portal/users/users",
|
||||
},
|
||||
]
|
||||
if (isEnabled(TENANT_FEATURE_FLAGS.USER_GROUPS)) {
|
||||
userSubPages.push({
|
||||
title: "Groups",
|
||||
href: "/builder/portal/users/groups",
|
||||
})
|
||||
}
|
||||
|
||||
// Determine settings sub pages
|
||||
let settingsSubPages = [
|
||||
{
|
||||
title: "Auth",
|
||||
|
@ -53,35 +57,15 @@ export const menu = derived([admin, auth], ([$admin, $auth]) => {
|
|||
href: "/builder/portal/settings/version",
|
||||
})
|
||||
}
|
||||
|
||||
menu = [
|
||||
{
|
||||
title: "Apps",
|
||||
href: "/builder/portal/apps",
|
||||
},
|
||||
{
|
||||
title: "Users",
|
||||
href: "/builder/portal/users",
|
||||
subPages: userSubPages,
|
||||
},
|
||||
{
|
||||
title: "Plugins",
|
||||
href: "/builder/portal/plugins",
|
||||
},
|
||||
{
|
||||
title: "Settings",
|
||||
href: "/builder/portal/settings",
|
||||
subPages: settingsSubPages,
|
||||
},
|
||||
]
|
||||
menu.push({
|
||||
title: "Settings",
|
||||
href: "/builder/portal/settings",
|
||||
subPages: settingsSubPages,
|
||||
})
|
||||
}
|
||||
|
||||
// Check if allowed access to account section
|
||||
if (
|
||||
isEnabled(TENANT_FEATURE_FLAGS.LICENSING) &&
|
||||
($auth?.user?.accountPortalAccess || (!$admin.cloud && $auth.isAdmin))
|
||||
) {
|
||||
// Determine account sub pages
|
||||
// Add account page
|
||||
if (isEnabled(TENANT_FEATURE_FLAGS.LICENSING)) {
|
||||
let accountSubPages = [
|
||||
{
|
||||
title: "Usage",
|
||||
|
@ -93,7 +77,7 @@ export const menu = derived([admin, auth], ([$admin, $auth]) => {
|
|||
title: "Upgrade",
|
||||
href: $admin.accountPortalUrl + "/portal/upgrade",
|
||||
})
|
||||
} else if (!$admin.cloud && admin) {
|
||||
} else if (!$admin.cloud && $auth.isAdmin) {
|
||||
accountSubPages.push({
|
||||
title: "Upgrade",
|
||||
href: "/builder/portal/account/upgrade",
|
||||
|
@ -108,7 +92,6 @@ export const menu = derived([admin, auth], ([$admin, $auth]) => {
|
|||
href: $admin.accountPortalUrl + "/portal/billing",
|
||||
})
|
||||
}
|
||||
|
||||
menu.push({
|
||||
title: "Account",
|
||||
href: "/builder/portal/account",
|
||||
|
|
Loading…
Reference in New Issue