Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
gitlab-ce
Commits
b9b2d086
Commit
b9b2d086
authored
Jul 24, 2015
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Dynamically check `:admin_*` ability in IssuableBaseService
Closes #2092
parent
e496c35f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
2 deletions
+14
-2
app/services/issuable_base_service.rb
app/services/issuable_base_service.rb
+4
-2
app/services/issues/base_service.rb
app/services/issues/base_service.rb
+4
-0
app/services/merge_requests/base_service.rb
app/services/merge_requests/base_service.rb
+6
-0
No files found.
app/services/issuable_base_service.rb
View file @
b9b2d086
...
...
@@ -27,8 +27,10 @@ class IssuableBaseService < BaseService
old_branch
,
new_branch
)
end
def
filter_params
unless
can?
(
current_user
,
:admin_issue
,
project
)
def
filter_params
(
issuable_ability_name
=
:issue
)
ability
=
:"admin_
#{
issuable_ability_name
}
"
unless
can?
(
current_user
,
ability
,
project
)
params
.
delete
(
:milestone_id
)
params
.
delete
(
:label_ids
)
params
.
delete
(
:assignee_id
)
...
...
app/services/issues/base_service.rb
View file @
b9b2d086
...
...
@@ -10,6 +10,10 @@ module Issues
private
def
filter_params
super
(
:issue
)
end
def
execute_hooks
(
issue
,
action
=
'open'
)
issue_data
=
hook_data
(
issue
,
action
)
issue
.
project
.
execute_hooks
(
issue_data
,
:issue_hooks
)
...
...
app/services/merge_requests/base_service.rb
View file @
b9b2d086
...
...
@@ -20,5 +20,11 @@ module MergeRequests
merge_request
.
project
.
execute_services
(
merge_data
,
:merge_request_hooks
)
end
end
private
def
filter_params
super
(
:merge_request
)
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment