Fix policy scope display for inherited scoped policies

What does this MR do and why?

This MR fixes a bug where inherited group policies that are scoped to specific projects incorrectly display "This project" in the scope column when viewed from a project they are not scoped to.

Current behavior: Group-level policies scoped to specific projects show "This project" in all child projects, even those not in the policy scope.

Expected behavior: Group-level policies scoped to specific projects should show "Not scoped to this project" when viewed from projects outside their scope.

Screenshots or screen recordings

Before

project_not_scoped_to

Shows "This project" even though the policy is not scoped to this project.

After

Will show "Not scoped to this project" for inherited policies with a scope that doesn't include the current project.

How to set up and validate locally

  1. Upload a GitLab Ultimate license
  2. Navigate to a group with multiple projects => Secure => Policies => New policy
  3. Create a policy of any type and scope it to one specific child project
  4. Navigate to a different project in the group (one that the policy was NOT scoped to) => Secure => Policies
  5. Verify the inherited policy now shows "Not scoped to this project" instead of "This project"

MR acceptance checklist

  • Frontend-only change
  • Maintains existing behavior for non-inherited policies
  • Maintains existing behavior for inherited policies in default mode
  • Adds new text for inherited scoped policies not applying to current project

Closes #579772

Merge request reports

Loading