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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
fbae63a9
Commit
fbae63a9
authored
Jan 03, 2018
by
Jarka Kadlecová
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reorganise authorization checks
parent
55607e49
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
ee/lib/api/epic_issues.rb
ee/lib/api/epic_issues.rb
+11
-2
No files found.
ee/lib/api/epic_issues.rb
View file @
fbae63a9
...
...
@@ -2,13 +2,19 @@ module API
class
EpicIssues
<
Grape
::
API
before
do
authenticate!
authorize_
can_admin
!
authorize_
epics
!
end
helpers
do
def
authorize_epics!
forbidden!
unless
user_group
.
feature_available?
(
:epics
)
end
def
authorize_can_admin!
forbidden!
unless
user_group
.
feature_available?
(
:epics
)
# TODO: check for group feature instead
authorize!
(
:admin_epic
,
epic
)
end
def
check_epic_link!
forbidden!
if
link
.
epic
!=
epic
end
...
...
@@ -34,6 +40,9 @@ module API
requires
:position
,
type:
Integer
,
desc:
'The new position of the issue in the epic (index starting with 0)'
end
put
':id/-/epics/:epic_iid/issues/:epic_issue_id'
do
authorize_can_admin!
check_epic_link!
result
=
::
EpicIssues
::
UpdateService
.
new
(
link
,
current_user
,
{
position:
params
[
:position
].
to_i
}).
execute
# For now we return empty body
...
...
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