diff options
author | http://jneen.net/ <jneen@jneen.net> | 2016-08-16 11:32:08 -0700 |
---|---|---|
committer | http://jneen.net/ <jneen@jneen.net> | 2016-08-30 11:39:22 -0700 |
commit | 092861093066f6b474c2dc72de34acf64380a3e6 (patch) | |
tree | bd8517ffd858d545516b112823679a843671e370 /app | |
parent | 4d904bf3521b4600db228c48214f3892e86ac72a (diff) | |
download | gitlab-ce-092861093066f6b474c2dc72de34acf64380a3e6.tar.gz |
add and use MergeRequestPolicy
Diffstat (limited to 'app')
-rw-r--r-- | app/models/ability.rb | 7 | ||||
-rw-r--r-- | app/policies/merge_request_policy.rb | 3 |
2 files changed, 8 insertions, 2 deletions
diff --git a/app/models/ability.rb b/app/models/ability.rb index 1ea97855e04..b8e3e97b351 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -70,13 +70,14 @@ class Ability def abilities_by_subject_class(user:, subject:) case subject - when CommitStatus then commit_status_abilities(user, subject) when Project then ProjectPolicy.abilities(user, subject) when Issue then IssuePolicy.abilities(user, subject) + when MergeRequest then MergeRequestPolicy.abilities(user, subject) + + when CommitStatus then commit_status_abilities(user, subject) when Note then note_abilities(user, subject) when ProjectSnippet then project_snippet_abilities(user, subject) when PersonalSnippet then personal_snippet_abilities(user, subject) - when MergeRequest then merge_request_abilities(user, subject) when Group then group_abilities(user, subject) when Namespace then namespace_abilities(user, subject) when GroupMember then group_member_abilities(user, subject) @@ -100,6 +101,8 @@ class Ability ProjectPolicy.abilities(nil, subject) elsif subject.is_a?(Issue) IssuePolicy.abilities(nil, subject) + elsif subject.is_a?(MergeRequest) + MergeRequestPolicy.abilities(nil, subject) elsif subject.respond_to?(:project) ProjectPolicy.abilities(nil, subject.project) elsif subject.is_a?(Group) || subject.respond_to?(:group) diff --git a/app/policies/merge_request_policy.rb b/app/policies/merge_request_policy.rb new file mode 100644 index 00000000000..bc3afc626fb --- /dev/null +++ b/app/policies/merge_request_policy.rb @@ -0,0 +1,3 @@ +class MergeRequestPolicy < IssuablePolicy + # pass +end |