Remove public from role options for users
This commit is contained in:
parent
638ff655fb
commit
92f97eb71d
|
@ -1,13 +1,23 @@
|
||||||
<script>
|
<script>
|
||||||
import { Select } from "@budibase/bbui"
|
import { Select } from "@budibase/bbui"
|
||||||
import { roles } from "stores/backend"
|
import { roles } from "stores/backend"
|
||||||
import { RoleUtils } from "@budibase/frontend-core"
|
import { Constants, RoleUtils } from "@budibase/frontend-core"
|
||||||
|
|
||||||
export let value
|
export let value
|
||||||
export let error
|
export let error
|
||||||
export let placeholder = null
|
export let placeholder = null
|
||||||
export let autoWidth = false
|
export let autoWidth = false
|
||||||
export let quiet = 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>
|
</script>
|
||||||
|
|
||||||
<Select
|
<Select
|
||||||
|
@ -15,7 +25,7 @@
|
||||||
{quiet}
|
{quiet}
|
||||||
bind:value
|
bind:value
|
||||||
on:change
|
on:change
|
||||||
options={$roles}
|
{options}
|
||||||
getOptionLabel={role => role.name}
|
getOptionLabel={role => role.name}
|
||||||
getOptionValue={role => role._id}
|
getOptionValue={role => role._id}
|
||||||
getOptionColour={role => RoleUtils.getRoleColour(role._id)}
|
getOptionColour={role => RoleUtils.getRoleColour(role._id)}
|
||||||
|
|
|
@ -171,6 +171,7 @@
|
||||||
value={group.roles[
|
value={group.roles[
|
||||||
Object.keys(group.roles).find(x => x === fixedAppId)
|
Object.keys(group.roles).find(x => x === fixedAppId)
|
||||||
]}
|
]}
|
||||||
|
allowPublic={false}
|
||||||
/>
|
/>
|
||||||
<Icon
|
<Icon
|
||||||
on:click={() => removeGroup(group)}
|
on:click={() => removeGroup(group)}
|
||||||
|
@ -193,6 +194,7 @@
|
||||||
value={user.roles[
|
value={user.roles[
|
||||||
Object.keys(user.roles).find(x => x === fixedAppId)
|
Object.keys(user.roles).find(x => x === fixedAppId)
|
||||||
]}
|
]}
|
||||||
|
allowPublic={false}
|
||||||
/>
|
/>
|
||||||
<Icon
|
<Icon
|
||||||
on:click={() => removeUser(user)}
|
on:click={() => removeUser(user)}
|
||||||
|
@ -224,14 +226,18 @@
|
||||||
<Layout gap="S">
|
<Layout gap="S">
|
||||||
<Heading>No users assigned</Heading>
|
<Heading>No users assigned</Heading>
|
||||||
<div class="opacity">
|
<div class="opacity">
|
||||||
<Body size="S"
|
<Body size="S">
|
||||||
>Assign users to your app and set their access here</Body
|
Assign users to your app and set their access here
|
||||||
>
|
</Body>
|
||||||
</div>
|
</div>
|
||||||
<div class="padding">
|
<div class="padding">
|
||||||
<Button on:click={() => assignmentModal.show()} cta icon="UserArrow"
|
<Button
|
||||||
>Assign Users</Button
|
on:click={() => assignmentModal.show()}
|
||||||
|
cta
|
||||||
|
icon="UserArrow"
|
||||||
>
|
>
|
||||||
|
Assign Users
|
||||||
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</Layout>
|
</Layout>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
} from "@budibase/bbui"
|
} from "@budibase/bbui"
|
||||||
import { roles } from "stores/backend"
|
import { roles } from "stores/backend"
|
||||||
import { groups, users, auth } from "stores/portal"
|
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"
|
import { createPaginationStore } from "helpers/pagination"
|
||||||
|
|
||||||
export let app
|
export let app
|
||||||
|
@ -109,7 +109,9 @@
|
||||||
autocomplete
|
autocomplete
|
||||||
showClearIcon={false}
|
showClearIcon={false}
|
||||||
primaryOptions={optionSections}
|
primaryOptions={optionSections}
|
||||||
secondaryOptions={$roles}
|
secondaryOptions={$roles.filter(
|
||||||
|
x => x._id !== Constants.Roles.PUBLIC
|
||||||
|
)}
|
||||||
secondaryPlaceholder="Access"
|
secondaryPlaceholder="Access"
|
||||||
bind:primaryValue={input.id}
|
bind:primaryValue={input.id}
|
||||||
bind:secondaryValue={input.role}
|
bind:secondaryValue={input.role}
|
||||||
|
|
Loading…
Reference in New Issue