Fixed `members/all` subgroup inherited members return
What does this MR do and why?
Updated members/all
API to also return "inherited-shared-groups" users, on subgroups.
This Mr also fixes /-/group_members
WebUI to correctly show inherited-shared-members.
This MR is bug has been reported on #321694 (comment 826392640), by @pierrefevrier, thanks for finding this.
Fixes: #321694 (closed)
Fixes: #214741 (closed)
Screenshots or screen recordings
Subgroup members WebUI before and after fix.
SQL Query
SQL
group = Group.find(9970)
finder = GroupMembersFinder
.new(group)
.execute(include_relations: [:shared_from_groups])
SELECT
"members".*
FROM
(
SELECT
DISTINCT ON (user_id, invite_email) *
FROM
"members"
WHERE
"members"."type" = 'GroupMember'
AND "members"."source_type" = 'Namespace'
AND "members"."requested_at" IS NULL
AND "members"."source_id" IN (
SELECT
"namespaces"."id"
FROM
"namespaces"
INNER JOIN "group_group_links" ON "group_group_links"."shared_with_group_id" = "namespaces"."id"
WHERE
"namespaces"."type" = 'Group'
AND "group_group_links"."shared_group_id" IN (
SELECT
"namespaces"."id"
FROM
"namespaces"
WHERE
"namespaces"."type" = 'Group'
AND "namespaces"."id" = 9970
)
)
AND (members.access_level > 5)
ORDER BY
user_id,
invite_email,
access_level DESC,
expires_at DESC,
created_at ASC
) members
WHERE
"members"."type" = 'GroupMember'
https://postgres.ai/console/gitlab/gitlab-production-tunnel-pg12/sessions/11053/commands/39597
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Alex Pooley