mirror of
https://github.com/coder/coder.git
synced 2025-07-18 14:17:22 +00:00
chore: remove organization_id suffix from org_member roles in database (#13473)
Organization member's table is already scoped to an organization. Rolename should avoid having the org_id appended. Wipes all existing organization role assignments, which should not be used anyway.
This commit is contained in:
@ -8432,12 +8432,14 @@ SELECT
|
||||
array_append(users.rbac_roles, 'member'),
|
||||
(
|
||||
SELECT
|
||||
array_agg(org_roles)
|
||||
-- The roles are returned as a flat array, org scoped and site side.
|
||||
-- Concatenating the organization id scopes the organization roles.
|
||||
array_agg(org_roles || ':' || organization_members.organization_id::text)
|
||||
FROM
|
||||
organization_members,
|
||||
-- All org_members get the org-member role for their orgs
|
||||
-- All org_members get the organization-member role for their orgs
|
||||
unnest(
|
||||
array_append(roles, 'organization-member:' || organization_members.organization_id::text)
|
||||
array_append(roles, 'organization-member')
|
||||
) AS org_roles
|
||||
WHERE
|
||||
user_id = users.id
|
||||
|
Reference in New Issue
Block a user