Skip to content

Allow protected refs to be configured with related groups

What does this MR do and why?

Allow protected refs to be configured with any related groups

  • Update protected ref validation to allow groups that project is namespaced under

Contributes to: #345140 (closed)

Related frontend changes: !130768 (merged)

Example queries

This change causes an additional query here: !130674 (diffs)

With use_traversal_ids enabled (enabled by default): https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/21946/commands/71098

SELECT
    1 AS one
FROM
    "namespaces"
WHERE
    "namespaces"."type" = 'Group'
    AND "namespaces"."id" IN (9970, 1819570)
    AND "namespaces"."id" = 1819570
LIMIT 1

With use_traversal_ids disabled: https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/21946/commands/71097

WITH RECURSIVE "base_and_ancestors" AS (
(
        SELECT
            "namespaces".*
        FROM
            "namespaces"
        WHERE
            "namespaces"."type" = 'Group'
            AND "namespaces"."id" = 1819570)
    UNION (
        SELECT
            "namespaces".*
        FROM
            "namespaces",
            "base_and_ancestors"
        WHERE
            "namespaces"."type" = 'Group'
            AND "namespaces"."id" = "base_and_ancestors"."parent_id"))
SELECT
    1 AS one
FROM
    "base_and_ancestors" AS "namespaces"
WHERE
    "namespaces"."id" = 1819570
LIMIT 1

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #345140 (closed)

Edited by Jerry Seto

Merge request reports