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()
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,

View File

@ -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"

View File

@ -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) => {

View File

@ -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 },

View File

@ -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