Merge branch 'master' into remove-apidoc-comments

This commit is contained in:
Michael Drury 2023-10-27 13:36:07 +01:00 committed by GitHub
commit a669712d0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 5 deletions

View File

@ -39,7 +39,15 @@
allowCreator allowCreator
) => { ) => {
if (allowedRoles?.length) { if (allowedRoles?.length) {
return roles.filter(role => allowedRoles.includes(role._id)) const filteredRoles = roles.filter(role =>
allowedRoles.includes(role._id)
)
return [
...filteredRoles,
...(allowedRoles.includes(Constants.Roles.CREATOR)
? [{ _id: Constants.Roles.CREATOR, name: "Creator", enabled: false }]
: []),
]
} }
let newRoles = [...roles] let newRoles = [...roles]
@ -129,8 +137,9 @@
getOptionColour={getColor} getOptionColour={getColor}
getOptionIcon={getIcon} getOptionIcon={getIcon}
isOptionEnabled={option => isOptionEnabled={option =>
option._id !== Constants.Roles.CREATOR || (option._id !== Constants.Roles.CREATOR ||
$licensing.perAppBuildersEnabled} $licensing.perAppBuildersEnabled) &&
option.enabled !== false}
{placeholder} {placeholder}
{error} {error}
/> />

View File

@ -516,6 +516,13 @@
} }
return null return null
} }
const parseRole = user => {
if (user.isAdminOrGlobalBuilder) {
return Constants.Roles.CREATOR
}
return user.role
}
</script> </script>
<svelte:window on:keydown={handleKeyDown} /> <svelte:window on:keydown={handleKeyDown} />
@ -725,7 +732,7 @@
<RoleSelect <RoleSelect
footer={getRoleFooter(user)} footer={getRoleFooter(user)}
placeholder={false} placeholder={false}
value={user.role} value={parseRole(user)}
allowRemove={user.role && !user.group} allowRemove={user.role && !user.group}
allowPublic={false} allowPublic={false}
allowCreator={true} allowCreator={true}
@ -744,7 +751,7 @@
autoWidth autoWidth
align="right" align="right"
allowedRoles={user.isAdminOrGlobalBuilder allowedRoles={user.isAdminOrGlobalBuilder
? [Constants.Roles.ADMIN] ? [Constants.Roles.CREATOR]
: null} : null}
/> />
</div> </div>