prevent editing public role in apps

This commit is contained in:
Martin McKeaveney 2021-07-06 18:54:08 +01:00
parent 13517d5298
commit 78bd36304e
1 changed files with 3 additions and 1 deletions

View File

@ -10,6 +10,8 @@
let selectedRole = {} let selectedRole = {}
let errors = [] let errors = []
let builtInRoles = ["Admin", "Power", "Basic", "Public"] let builtInRoles = ["Admin", "Power", "Basic", "Public"]
// Don't allow editing of public role
$: allRoles = $roles.filter(role => role._id !== "PUBLIC")
$: selectedRoleId = selectedRole._id $: selectedRoleId = selectedRole._id
$: otherRoles = $roles.filter(role => role._id !== selectedRoleId) $: otherRoles = $roles.filter(role => role._id !== selectedRoleId)
$: isCreating = selectedRoleId == null || selectedRoleId === "" $: isCreating = selectedRoleId == null || selectedRoleId === ""
@ -96,7 +98,7 @@
label="Role" label="Role"
value={selectedRoleId} value={selectedRoleId}
on:change={changeRole} on:change={changeRole}
options={$roles} options={allRoles}
placeholder="Create new role" placeholder="Create new role"
getOptionValue={role => role._id} getOptionValue={role => role._id}
getOptionLabel={role => role.name} getOptionLabel={role => role.name}