Update user invitation modal and details page to allow creating creator users
This commit is contained in:
parent
35a35f92e6
commit
b72b93e5b2
|
@ -98,7 +98,17 @@
|
||||||
return y._id === userId
|
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) => {
|
const getAvailableApps = (appList, privileged, roles) => {
|
||||||
let availableApps = appList.slice()
|
let availableApps = appList.slice()
|
||||||
|
@ -177,12 +187,17 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
async function updateUserRole({ detail }) {
|
async function updateUserRole({ detail }) {
|
||||||
if (detail === "developer") {
|
if (detail === Constants.BudibaseRoles.Developer) {
|
||||||
toggleFlags({ admin: { global: false }, builder: { global: true } })
|
toggleFlags({ admin: { global: false }, builder: { global: true } })
|
||||||
} else if (detail === "admin") {
|
} else if (detail === Constants.BudibaseRoles.Admin) {
|
||||||
toggleFlags({ admin: { global: true }, builder: { global: true } })
|
toggleFlags({ admin: { global: true }, builder: { global: true } })
|
||||||
} else if (detail === "appUser") {
|
} else if (detail === Constants.BudibaseRoles.AppUser) {
|
||||||
toggleFlags({ admin: { global: false }, builder: { global: false } })
|
toggleFlags({ admin: { global: false }, builder: { global: false } })
|
||||||
|
} else if (detail === Constants.BudibaseRoles.Creator) {
|
||||||
|
toggleFlags({
|
||||||
|
admin: { global: false },
|
||||||
|
builder: { global: false, creator: true },
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,7 @@
|
||||||
align-items: center;
|
align-items: center;
|
||||||
flex-direction: row;"
|
flex-direction: row;"
|
||||||
>
|
>
|
||||||
<div style="width: 90%">
|
<div style="flex: 1 1 auto;">
|
||||||
<InputDropdown
|
<InputDropdown
|
||||||
inputType="email"
|
inputType="email"
|
||||||
bind:inputValue={input.email}
|
bind:inputValue={input.email}
|
||||||
|
|
|
@ -171,6 +171,7 @@
|
||||||
const payload = userData?.users?.map(user => ({
|
const payload = userData?.users?.map(user => ({
|
||||||
email: user.email,
|
email: user.email,
|
||||||
builder: user.role === Constants.BudibaseRoles.Developer,
|
builder: user.role === Constants.BudibaseRoles.Developer,
|
||||||
|
creator: user.role === Constants.BudibaseRoles.Creator,
|
||||||
admin: user.role === Constants.BudibaseRoles.Admin,
|
admin: user.role === Constants.BudibaseRoles.Admin,
|
||||||
groups: userData.groups,
|
groups: userData.groups,
|
||||||
}))
|
}))
|
||||||
|
|
Loading…
Reference in New Issue