Updated custom roles payload for bypass options
What does this MR do and why?
This change modifies how custom roles are stored and handled in a policy exceptions feature. Previously, custom roles were stored as simple ID numbers in an array. Now they're stored as objects containing an ID property (like {id: 1} instead of just 1).
The code was updated in two main areas: when displaying existing custom roles, it now extracts just the ID numbers from these objects for display purposes, and when saving new custom role selections, it wraps the ID numbers in objects before storing them. The tests were also updated to reflect this new data structure, ensuring the feature continues to work correctly with the new format.
References
Screenshots or screen recordings
| Description | UI |
|---|---|
| Custom roles | custom.mov |
How to set up and validate locally
Enable feature flag:
Feature.enable(:security_policies_bypass_options)
Feature.enable(:security_policies_bypass_options_group_roles)
- Secure -> Policies
- New merge request approval policy
- Open Advanced settings
- Click add exception button
- Select
rolesoption (create custom roles if there are no custom roles) - Check when custom role is selected it is selected as { id: int } in yaml
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Related to #560031 (closed)