Skip to content

Approvers group does not persist after adding it to the approval rules

What does this MR do and why?

Problem

public_or_visible_to_user does not correctly resolves inherited permissions for subgroups.

For the structure,

Group A -> Group B
User has direct permissions to Group A

public_or_visible_to_user will return false for Group B.

Solution

Use accessible_to_user method to correctly apply the permission check.

How to set up and validate locally

See reproduction steps: #376289 (closed)

  1. Enable feature flag
Feature.enable(:approval_rules_eligible_filter)
  1. Create an approval rule with approval group sc_approvals_test/members/engineers
  2. You should see two approvers in the list
FF off FF on
Screenshot_2022-10-05_at_17.10.05 Screenshot_2022-10-05_at_17.08.01

MR acceptance checklist

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

Edited by Vasilii Iakliushin

Merge request reports