add developer label back and improve invite flow

This commit is contained in:
Peter Clement 2023-09-05 09:58:05 +01:00
parent 6d3a7727eb
commit c16fd53b0a
5 changed files with 15 additions and 7 deletions

View File

@ -120,7 +120,7 @@
await usersFetch.refresh() await usersFetch.refresh()
filteredUsers = $usersFetch.rows filteredUsers = $usersFetch.rows
.filter(user => !user?.admin?.global) // filter out global admins .filter(user => user.email !== $auth.user.email)
.map(user => { .map(user => {
const isAdminOrGlobalBuilder = sdk.users.isAdminOrGlobalBuilder( const isAdminOrGlobalBuilder = sdk.users.isAdminOrGlobalBuilder(
user, user,

View File

@ -10,7 +10,7 @@
admin: "Full access", admin: "Full access",
} }
$: role = Constants.BudibaseRoleOptions.find( $: role = Constants.BudibaseRoleOptionsOld.find(
x => x.value === users.getUserRole(row) x => x.value === users.getUserRole(row)
) )
$: value = role?.label || "Not available" $: value = role?.label || "Not available"

View File

@ -121,8 +121,11 @@ export function createUsersStore() {
} }
const getUserRole = user => const getUserRole = user =>
sdk.users.isAdminOrGlobalBuilder(user) ? "admin" : "appUser" sdk.users.isAdmin(user)
? "admin"
: sdk.users.isBuilder(user)
? "developer"
: "appUser"
const refreshUsage = const refreshUsage =
fn => fn =>
async (...args) => { async (...args) => {

View File

@ -23,6 +23,11 @@ export const BudibaseRoles = {
Admin: "admin", Admin: "admin",
} }
export const BudibaseRoleOptionsOld = [
{ label: "Developer", value: BudibaseRoles.Developer },
{ label: "Member", value: BudibaseRoles.AppUser },
{ label: "Admin", value: BudibaseRoles.Admin },
]
export const BudibaseRoleOptions = [ export const BudibaseRoleOptions = [
{ label: "Member", value: BudibaseRoles.AppUser }, { label: "Member", value: BudibaseRoles.AppUser },
{ label: "Admin", value: BudibaseRoles.Admin }, { label: "Admin", value: BudibaseRoles.Admin },

View File

@ -403,15 +403,15 @@ export const inviteAccept = async (
lastName, lastName,
password, password,
email, email,
admin: { global: info.admin.global || false }, admin: { global: info?.admin?.global || false },
roles: info.apps, roles: info.apps,
tenantId: info.tenantId, tenantId: info.tenantId,
} }
let builder: { global: boolean; apps?: string[] } = { 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 builder.apps = info.builder.apps
request.builder = builder request.builder = builder
delete info.builder.apps delete info.builder.apps