Welcome to mirror list, hosted at ThFree Co, Russian Federation.

merge_request_policy.rb « policies « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e5ac228b0eeec87ea22f0cb664e441fa0992ddd4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# frozen_string_literal: true

class MergeRequestPolicy < IssuablePolicy
  rule { locked }.policy do
    prevent :reopen_merge_request
  end

  # Only users who can read the merge request can comment.
  # Although :read_merge_request is computed in the policy context,
  # it would not be safe to prevent :create_note there, since
  # note permissions are shared, and this would apply too broadly.
  rule { ~can?(:read_merge_request) }.prevent :create_note

  rule { can?(:update_merge_request) }.policy do
    enable :approve_merge_request
  end
end

MergeRequestPolicy.prepend_if_ee('EE::MergeRequestPolicy')