diff --git a/packages/builder/src/pages/builder/app/[application]/_components/BuilderSidePanel.svelte b/packages/builder/src/pages/builder/app/[application]/_components/BuilderSidePanel.svelte index b0ab9edd04..5f89762eac 100644 --- a/packages/builder/src/pages/builder/app/[application]/_components/BuilderSidePanel.svelte +++ b/packages/builder/src/pages/builder/app/[application]/_components/BuilderSidePanel.svelte @@ -120,7 +120,7 @@ await usersFetch.refresh() filteredUsers = $usersFetch.rows - .filter(user => !user?.admin?.global) // filter out global admins + .filter(user => user.email !== $auth.user.email) .map(user => { const isAdminOrGlobalBuilder = sdk.users.isAdminOrGlobalBuilder( user, diff --git a/packages/builder/src/pages/builder/portal/users/users/_components/RoleTableRenderer.svelte b/packages/builder/src/pages/builder/portal/users/users/_components/RoleTableRenderer.svelte index 8217c85c5e..43fe8cc1cc 100644 --- a/packages/builder/src/pages/builder/portal/users/users/_components/RoleTableRenderer.svelte +++ b/packages/builder/src/pages/builder/portal/users/users/_components/RoleTableRenderer.svelte @@ -10,7 +10,7 @@ admin: "Full access", } - $: role = Constants.BudibaseRoleOptions.find( + $: role = Constants.BudibaseRoleOptionsOld.find( x => x.value === users.getUserRole(row) ) $: value = role?.label || "Not available" diff --git a/packages/builder/src/stores/portal/users.js b/packages/builder/src/stores/portal/users.js index 996a94013b..3ee0516544 100644 --- a/packages/builder/src/stores/portal/users.js +++ b/packages/builder/src/stores/portal/users.js @@ -121,8 +121,11 @@ export function createUsersStore() { } const getUserRole = user => - sdk.users.isAdminOrGlobalBuilder(user) ? "admin" : "appUser" - + sdk.users.isAdmin(user) + ? "admin" + : sdk.users.isBuilder(user) + ? "developer" + : "appUser" const refreshUsage = fn => async (...args) => { diff --git a/packages/frontend-core/src/constants.js b/packages/frontend-core/src/constants.js index 198d88196b..cfaaaea81b 100644 --- a/packages/frontend-core/src/constants.js +++ b/packages/frontend-core/src/constants.js @@ -23,6 +23,11 @@ export const BudibaseRoles = { Admin: "admin", } +export const BudibaseRoleOptionsOld = [ + { label: "Developer", value: BudibaseRoles.Developer }, + { label: "Member", value: BudibaseRoles.AppUser }, + { label: "Admin", value: BudibaseRoles.Admin }, +] export const BudibaseRoleOptions = [ { label: "Member", value: BudibaseRoles.AppUser }, { label: "Admin", value: BudibaseRoles.Admin }, diff --git a/packages/worker/src/api/controllers/global/users.ts b/packages/worker/src/api/controllers/global/users.ts index a084685dd3..a73c4de8e7 100644 --- a/packages/worker/src/api/controllers/global/users.ts +++ b/packages/worker/src/api/controllers/global/users.ts @@ -403,15 +403,15 @@ export const inviteAccept = async ( lastName, password, email, - admin: { global: info.admin.global || false }, + admin: { global: info?.admin?.global || false }, roles: info.apps, tenantId: info.tenantId, } let builder: { global: boolean; apps?: string[] } = { - global: info.builder.global || false, + global: info?.builder?.global || false, } - if (info.builder.apps) { + if (info?.builder?.apps) { builder.apps = info.builder.apps request.builder = builder delete info.builder.apps