Remove public from role options for users

This commit is contained in:
Andrew Kingston 2022-08-05 10:52:34 +01:00
parent aab0a72ef9
commit 66ec56e631
3 changed files with 27 additions and 9 deletions

View File

@ -1,13 +1,23 @@
<script>
import { Select } from "@budibase/bbui"
import { roles } from "stores/backend"
import { RoleUtils } from "@budibase/frontend-core"
import { Constants, RoleUtils } from "@budibase/frontend-core"
export let value
export let error
export let placeholder = null
export let autoWidth = false
export let quiet = false
export let allowPublic = true
$: options = getOptions($roles, allowPublic)
const getOptions = (roles, allowPublic) => {
if (allowPublic) {
return roles
}
return roles.filter(role => role._id !== Constants.Roles.PUBLIC)
}
</script>
<Select
@ -15,7 +25,7 @@
{quiet}
bind:value
on:change
options={$roles}
{options}
getOptionLabel={role => role.name}
getOptionValue={role => role._id}
getOptionColour={role => RoleUtils.getRoleColour(role._id)}

View File

@ -171,6 +171,7 @@
value={group.roles[
Object.keys(group.roles).find(x => x === fixedAppId)
]}
allowPublic={false}
/>
<Icon
on:click={() => removeGroup(group)}
@ -193,6 +194,7 @@
value={user.roles[
Object.keys(user.roles).find(x => x === fixedAppId)
]}
allowPublic={false}
/>
<Icon
on:click={() => removeUser(user)}
@ -224,14 +226,18 @@
<Layout gap="S">
<Heading>No users assigned</Heading>
<div class="opacity">
<Body size="S"
>Assign users to your app and set their access here</Body
>
<Body size="S">
Assign users to your app and set their access here
</Body>
</div>
<div class="padding">
<Button on:click={() => assignmentModal.show()} cta icon="UserArrow"
>Assign Users</Button
<Button
on:click={() => assignmentModal.show()}
cta
icon="UserArrow"
>
Assign Users
</Button>
</div>
</Layout>
</div>

View File

@ -9,7 +9,7 @@
} from "@budibase/bbui"
import { roles } from "stores/backend"
import { groups, users, auth } from "stores/portal"
import { RoleUtils } from "@budibase/frontend-core"
import { Constants, RoleUtils } from "@budibase/frontend-core"
import { createPaginationStore } from "helpers/pagination"
export let app
@ -109,7 +109,9 @@
autocomplete
showClearIcon={false}
primaryOptions={optionSections}
secondaryOptions={$roles}
secondaryOptions={$roles.filter(
x => x._id !== Constants.Roles.PUBLIC
)}
secondaryPlaceholder="Access"
bind:primaryValue={input.id}
bind:secondaryValue={input.role}