2018-11-18 11:00:15 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-09-29 09:46:39 +05:30
|
|
|
class MergeRequestPolicy < IssuablePolicy
|
2019-07-07 11:18:12 +05:30
|
|
|
rule { locked }.policy do
|
|
|
|
prevent :reopen_merge_request
|
|
|
|
end
|
2019-09-04 21:01:54 +05:30
|
|
|
|
|
|
|
# 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
|
2020-07-28 23:09:34 +05:30
|
|
|
|
|
|
|
rule { can?(:update_merge_request) }.policy do
|
|
|
|
enable :approve_merge_request
|
|
|
|
end
|
2016-09-29 09:46:39 +05:30
|
|
|
end
|
2019-12-04 20:38:33 +05:30
|
|
|
|
|
|
|
MergeRequestPolicy.prepend_if_ee('EE::MergeRequestPolicy')
|