summaryrefslogtreecommitdiff
path: root/app/models/ability.rb
diff options
context:
space:
mode:
authorhttp://jneen.net/ <jneen@jneen.net>2016-08-16 11:32:08 -0700
committerhttp://jneen.net/ <jneen@jneen.net>2016-08-30 11:39:22 -0700
commit092861093066f6b474c2dc72de34acf64380a3e6 (patch)
treebd8517ffd858d545516b112823679a843671e370 /app/models/ability.rb
parent4d904bf3521b4600db228c48214f3892e86ac72a (diff)
downloadgitlab-ce-092861093066f6b474c2dc72de34acf64380a3e6.tar.gz
add and use MergeRequestPolicy
Diffstat (limited to 'app/models/ability.rb')
-rw-r--r--app/models/ability.rb7
1 files changed, 5 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)