Update user invitation modal and details page to allow creating creator users

This commit is contained in:
Andrew Kingston 2023-11-23 14:03:23 +00:00
parent 35a35f92e6
commit b72b93e5b2
3 changed files with 21 additions and 5 deletions

View File

@ -98,7 +98,17 @@
return y._id === userId
})
})
$: globalRole = sdk.users.isAdmin(user) ? "admin" : "appUser"
$: globalRole = getGlobalRole(user)
const getGlobalRole = user => {
if (sdk.users.isAdmin(user)) {
return Constants.BudibaseRoles.Admin
} else if (sdk.users.isCreator(user)) {
return Constants.BudibaseRoles.Creator
} else {
return Constants.BudibaseRoles.AppUser
}
}
const getAvailableApps = (appList, privileged, roles) => {
let availableApps = appList.slice()
@ -177,12 +187,17 @@
}
async function updateUserRole({ detail }) {
if (detail === "developer") {
if (detail === Constants.BudibaseRoles.Developer) {
toggleFlags({ admin: { global: false }, builder: { global: true } })
} else if (detail === "admin") {
} else if (detail === Constants.BudibaseRoles.Admin) {
toggleFlags({ admin: { global: true }, builder: { global: true } })
} else if (detail === "appUser") {
} else if (detail === Constants.BudibaseRoles.AppUser) {
toggleFlags({ admin: { global: false }, builder: { global: false } })
} else if (detail === Constants.BudibaseRoles.Creator) {
toggleFlags({
admin: { global: false },
builder: { global: false, creator: true },
})
}
}

View File

@ -98,7 +98,7 @@
align-items: center;
flex-direction: row;"
>
<div style="width: 90%">
<div style="flex: 1 1 auto;">
<InputDropdown
inputType="email"
bind:inputValue={input.email}

View File

@ -171,6 +171,7 @@
const payload = userData?.users?.map(user => ({
email: user.email,
builder: user.role === Constants.BudibaseRoles.Developer,
creator: user.role === Constants.BudibaseRoles.Creator,
admin: user.role === Constants.BudibaseRoles.Admin,
groups: userData.groups,
}))