Allow full path search for "/projects/:id/share_locations" API endpoint
What does this MR do and why?
Fixes #393439 (closed).
The service used to fetch Group records for the /projects/:id/share_locations
endpoint did not allow for searching with full group paths, which is what this MR fixes.
Added more detail as inline comment.
Query plans
https://gitlab.com/api/v4/projects/278964/share_locations?search=gitlab-gold/briecarranza/experimental/306349
as admin, SELECT "namespaces".* FROM "namespaces" WHERE "namespaces"."type" = 'Group' AND "namespaces"."type" != 'Project' AND "namespaces"."id" IN (SELECT "routes"."source_id" FROM "routes" WHERE "routes"."source_type" = 'Namespace' AND ("routes"."path" ILIKE '%gitlab-gold/briecarranza/experimental/306349%' OR "routes"."name" ILIKE '%gitlab-gold/briecarranza/experimental/306349%')) ORDER BY "namespaces"."path" ASC, "namespaces"."id" ASC LIMIT 20 OFFSET 0
Query plan: https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/15984/commands/55116
https://gitlab.com/api/v4/projects/278964/share_locations?search=gitlab-gold/briecarranza/experimental/306349
, user manojmj
as non-admin, WITH RECURSIVE "base_and_descendants" AS ((SELECT "namespaces".* FROM "namespaces" INNER JOIN "members" ON "namespaces"."id" = "members"."source_id" WHERE "members"."type" = 'GroupMember' AND "members"."source_type" = 'Namespace' AND "namespaces"."type" = 'Group' AND "members"."user_id" = 4093067 AND "members"."requested_at" IS NULL AND (access_level >= 10) AND (members.access_level >= 10))
UNION
(SELECT "namespaces".* FROM "namespaces", "base_and_descendants" WHERE "namespaces"."type" = 'Group' AND "namespaces"."parent_id" = "base_and_descendants"."id")) SELECT "namespaces".* FROM "base_and_descendants" AS "namespaces" WHERE "namespaces"."type" != 'Project' AND "namespaces"."id" IN (SELECT "routes"."source_id" FROM "routes" WHERE "routes"."source_type" = 'Namespace' AND ("routes"."path" ILIKE '%gitlab-gold/briecarranza/experimental/306349%' OR "routes"."name" ILIKE '%gitlab-gold/briecarranza/experimental/306349%')) ORDER BY "namespaces"."path" ASC, "namespaces"."id" ASC LIMIT 20 OFFSET 0
Query plan: https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/15984/commands/55120
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
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.
Related to #393439 (closed)