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"
|
import { auth } from "./auth"
|
||||||
|
|
||||||
export const menu = derived([admin, auth], ([$admin, $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 = [
|
let menu = [
|
||||||
{
|
{
|
||||||
title: "Apps",
|
title: "Apps",
|
||||||
href: "/builder/portal/apps",
|
href: "/builder/portal/apps",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: "Users",
|
||||||
|
href: "/builder/portal/users",
|
||||||
|
subPages: userSubPages,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: "Plugins",
|
title: "Plugins",
|
||||||
href: "/builder/portal/plugins",
|
href: "/builder/portal/plugins",
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
// Admin only pages
|
// Add settings page for admins
|
||||||
if ($auth.isAdmin) {
|
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 = [
|
let settingsSubPages = [
|
||||||
{
|
{
|
||||||
title: "Auth",
|
title: "Auth",
|
||||||
|
@ -53,35 +57,15 @@ export const menu = derived([admin, auth], ([$admin, $auth]) => {
|
||||||
href: "/builder/portal/settings/version",
|
href: "/builder/portal/settings/version",
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
menu.push({
|
||||||
menu = [
|
title: "Settings",
|
||||||
{
|
href: "/builder/portal/settings",
|
||||||
title: "Apps",
|
subPages: settingsSubPages,
|
||||||
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,
|
|
||||||
},
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if allowed access to account section
|
// Add account page
|
||||||
if (
|
if (isEnabled(TENANT_FEATURE_FLAGS.LICENSING)) {
|
||||||
isEnabled(TENANT_FEATURE_FLAGS.LICENSING) &&
|
|
||||||
($auth?.user?.accountPortalAccess || (!$admin.cloud && $auth.isAdmin))
|
|
||||||
) {
|
|
||||||
// Determine account sub pages
|
|
||||||
let accountSubPages = [
|
let accountSubPages = [
|
||||||
{
|
{
|
||||||
title: "Usage",
|
title: "Usage",
|
||||||
|
@ -93,7 +77,7 @@ export const menu = derived([admin, auth], ([$admin, $auth]) => {
|
||||||
title: "Upgrade",
|
title: "Upgrade",
|
||||||
href: $admin.accountPortalUrl + "/portal/upgrade",
|
href: $admin.accountPortalUrl + "/portal/upgrade",
|
||||||
})
|
})
|
||||||
} else if (!$admin.cloud && admin) {
|
} else if (!$admin.cloud && $auth.isAdmin) {
|
||||||
accountSubPages.push({
|
accountSubPages.push({
|
||||||
title: "Upgrade",
|
title: "Upgrade",
|
||||||
href: "/builder/portal/account/upgrade",
|
href: "/builder/portal/account/upgrade",
|
||||||
|
@ -108,7 +92,6 @@ export const menu = derived([admin, auth], ([$admin, $auth]) => {
|
||||||
href: $admin.accountPortalUrl + "/portal/billing",
|
href: $admin.accountPortalUrl + "/portal/billing",
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
menu.push({
|
menu.push({
|
||||||
title: "Account",
|
title: "Account",
|
||||||
href: "/builder/portal/account",
|
href: "/builder/portal/account",
|
||||||
|
|
Loading…
Reference in New Issue