Merge pull request #13230 from Budibase/fix/group-member-protection

Fix - Group members edits only for admins
This commit is contained in:
Adria Navarro 2024-03-11 16:52:19 +01:00 committed by GitHub
commit 86926ad86f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 20 additions and 17 deletions

View File

@ -39,9 +39,10 @@
name: { name: {
width: "1fr", width: "1fr",
}, },
...(readonly ...(!isAdmin
? {} ? {}
: { : // Add
{
_id: { _id: {
displayName: "", displayName: "",
width: "auto", width: "auto",
@ -90,7 +91,9 @@
$: internalGroups = $groups?.filter(g => !g?.scimInfo?.isSync) $: internalGroups = $groups?.filter(g => !g?.scimInfo?.isSync)
$: isSSO = !!user?.provider $: isSSO = !!user?.provider
$: readonly = !sdk.users.isAdmin($auth.user) || user?.scimInfo?.isSync $: isAdmin = sdk.users.isAdmin($auth.user)
$: isScim = user?.scimInfo?.isSync
$: readonly = !isAdmin || isScim
$: privileged = sdk.users.isAdminOrGlobalBuilder(user) $: privileged = sdk.users.isAdminOrGlobalBuilder(user)
$: nameLabel = getNameLabel(user) $: nameLabel = getNameLabel(user)
$: filteredGroups = getFilteredGroups(internalGroups, searchTerm) $: filteredGroups = getFilteredGroups(internalGroups, searchTerm)
@ -322,11 +325,10 @@
<Layout gap="S" noPadding> <Layout gap="S" noPadding>
<div class="tableTitle"> <div class="tableTitle">
<Heading size="S">Groups</Heading> <Heading size="S">Groups</Heading>
{#if internalGroups?.length} {#if internalGroups?.length && isAdmin}
<div bind:this={popoverAnchor}> <div bind:this={popoverAnchor}>
<Button on:click={popover.show()} secondary>Add to group</Button> <Button on:click={popover.show()} secondary>Add to group</Button>
</div> </div>
{/if}
<Popover align="right" bind:this={popover} anchor={popoverAnchor}> <Popover align="right" bind:this={popover} anchor={popoverAnchor}>
<UserGroupPicker <UserGroupPicker
labelKey="name" labelKey="name"
@ -339,6 +341,7 @@
extractIconProps={item => ({ group: item, size: "S" })} extractIconProps={item => ({ group: item, size: "S" })}
/> />
</Popover> </Popover>
{/if}
</div> </div>
<Table <Table
schema={groupSchema} schema={groupSchema}

@ -1 +1 @@
Subproject commit 4e66a0f7042652763c238b10367310b168905f87 Subproject commit e565db07f6c51868087e88dfebde0328493443e6