Skip to content

Consolidate abilities for dashboard metrics annotations

What does this MR do and why?

  • Rather than having separate create/update/delete abilities, this MR consolidates them into 1 ability.
  • This is a proof of concept for the larger project described here: #393454

Screenshots or screen recordings

These are duplicates and so consolidating them is safe:

[1] pry(main)> GroupPolicy.ability_map.map.select { |k,v| k.match(/dashboard_annotation/) }
=> {:create_metrics_dashboard_annotation=>[[:enable, #<Rule developer>]],
 :delete_metrics_dashboard_annotation=>[[:enable, #<Rule developer>]],
 :update_metrics_dashboard_annotation=>[[:enable, #<Rule developer>]],
 :read_metrics_dashboard_annotation=>[[:enable, #<Rule reporter>]]}
[2] pry(main)> ProjectPolicy.ability_map.map.select { |k,v| k.match(/dashboard_annotation/) }
=> {:read_metrics_dashboard_annotation=>[[:enable, #<Rule can?(:reporter_access)>]],
 :create_metrics_dashboard_annotation=>[[:enable, #<Rule can?(:developer_access)>]],
 :delete_metrics_dashboard_annotation=>[[:enable, #<Rule can?(:developer_access)>]],
 :update_metrics_dashboard_annotation=>[[:enable, #<Rule can?(:developer_access)>]]}

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.

Edited by Jessie Young

Merge request reports

Loading