diff --git a/frontend/src/lib/components/datatableAcl/PgAclEditor.svelte b/frontend/src/lib/components/datatableAcl/PgAclEditor.svelte index ca0f801bfb..73f615fc36 100644 --- a/frontend/src/lib/components/datatableAcl/PgAclEditor.svelte +++ b/frontend/src/lib/components/datatableAcl/PgAclEditor.svelte @@ -206,7 +206,7 @@ {grant.privileges.join(', ')} - + {grantScopeLabel(grant)} {#if blocked.length > 0} { } expect(uncoveredCreators(future, ['admin', 'analytics', 'late'])).toEqual(['late']) expect(uncoveredCreators({ ...future, future: undefined }, ['late'])).toEqual([]) + // Set by a role outside the catalog, it was never meant to cover the catalog's roles. + expect( + uncoveredCreators({ ...future, sources: [by('postgres', ['SELECT'], false)] }, [ + 'admin', + 'late' + ]) + ).toEqual([]) }) }) diff --git a/frontend/src/lib/components/datatableAcl/aclScopes.ts b/frontend/src/lib/components/datatableAcl/aclScopes.ts index 174ff0cd77..edb837a693 100644 --- a/frontend/src/lib/components/datatableAcl/aclScopes.ts +++ b/frontend/src/lib/components/datatableAcl/aclScopes.ts @@ -152,10 +152,11 @@ export function blockingSources(grant: GroupedGrant, privileges: string[]): stri .map((s) => s.role) } -/** Which of `roles` a "created later" row does not cover. A default privilege binds only the - * creating roles it was granted for, so what the others create stays out of it. */ +/** Which of `roles` a "created later" row granted for some of them does not cover. A default + * privilege binds only the creating roles it was granted for, so what the others create stays out + * of it. One no role of `roles` set — the instance's own, say — was never meant to cover them. */ export function uncoveredCreators(grant: GroupedGrant, roles: string[]): string[] { - if (!grant.future) return [] + if (!grant.future || !grant.sources.some((s) => roles.includes(s.role))) return [] return roles.filter((r) => !grant.sources.some((s) => s.role === r)) }