Commit b9b2d086 authored by Robert Speicher's avatar Robert Speicher

Dynamically check `:admin_*` ability in IssuableBaseService

Closes #2092
parent e496c35f
...@@ -27,8 +27,10 @@ class IssuableBaseService < BaseService ...@@ -27,8 +27,10 @@ class IssuableBaseService < BaseService
old_branch, new_branch) old_branch, new_branch)
end end
def filter_params def filter_params(issuable_ability_name = :issue)
unless can?(current_user, :admin_issue, project) ability = :"admin_#{issuable_ability_name}"
unless can?(current_user, ability, project)
params.delete(:milestone_id) params.delete(:milestone_id)
params.delete(:label_ids) params.delete(:label_ids)
params.delete(:assignee_id) params.delete(:assignee_id)
......
...@@ -10,6 +10,10 @@ module Issues ...@@ -10,6 +10,10 @@ module Issues
private private
def filter_params
super(:issue)
end
def execute_hooks(issue, action = 'open') def execute_hooks(issue, action = 'open')
issue_data = hook_data(issue, action) issue_data = hook_data(issue, action)
issue.project.execute_hooks(issue_data, :issue_hooks) issue.project.execute_hooks(issue_data, :issue_hooks)
......
...@@ -20,5 +20,11 @@ module MergeRequests ...@@ -20,5 +20,11 @@ module MergeRequests
merge_request.project.execute_services(merge_data, :merge_request_hooks) merge_request.project.execute_services(merge_data, :merge_request_hooks)
end end
end end
private
def filter_params
super(:merge_request)
end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment