Skip to content

Adjust Merge Request policies for read-only state

Vijay Hawoldar requested to merge vij-mr-policies into master

What does this MR do and why?

In https://gitlab.com/gitlab-org/gitlab/-/issues/363473 we are adjusting which features are made read-only.

This MR adjusts the actions for merge requests from that list, allowing:

  • adding approvals
  • re-opening
  • adding comments
  • resolving comments

Read-only mode is not yet in use because it relates to unreleased work described in the linked issue above

How to set up and validate locally

  1. Checkout master branch
  2. Adjust the read_only? method to return true
      def read_only?
        true
      end
  3. Attempt perform the above actions on an MR
  4. 👆🏽 should not be possible
  5. Checkout this branch (vij-mr-policies)
  6. Re-attempt to perform the same actions
  7. 👆🏽 should be possible

Alternative

  1. Perform step 1 and 2 above
  2. In a rails console, perform the following before/after checking out this branch:
      u = User.first # or a user of your choice
      mr = MergeRequest.first # or an MR the user has developer/maintainer access too
    
      [:approve_merge_request, :reopen_merge_request, :create_note, :resolve_note].each { |policy| puts u.can?(policy, mr) }

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 Vijay Hawoldar

Merge request reports

Loading