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
Boxiang Sun
gitlab-ce
Commits
d0842d20
Commit
d0842d20
authored
Sep 25, 2017
by
Alexis Reigel
Committed by
Alexis Reigel
Apr 23, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
disallow group runners to become project runners
parent
4b1b2f3b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
0 deletions
+7
-0
lib/api/runners.rb
lib/api/runners.rb
+1
-0
spec/requests/api/runners_spec.rb
spec/requests/api/runners_spec.rb
+6
-0
No files found.
lib/api/runners.rb
View file @
d0842d20
...
@@ -206,6 +206,7 @@ module API
...
@@ -206,6 +206,7 @@ module API
def
authenticate_enable_runner!
(
runner
)
def
authenticate_enable_runner!
(
runner
)
forbidden!
(
"Runner is shared"
)
if
runner
.
is_shared?
forbidden!
(
"Runner is shared"
)
if
runner
.
is_shared?
forbidden!
(
"Runner is locked"
)
if
runner
.
locked?
forbidden!
(
"Runner is locked"
)
if
runner
.
locked?
forbidden!
(
"Runner is a group runner"
)
if
runner
.
group?
return
if
current_user
.
admin?
return
if
current_user
.
admin?
forbidden!
(
"No access granted"
)
unless
user_can_access_runner?
(
runner
)
forbidden!
(
"No access granted"
)
unless
user_can_access_runner?
(
runner
)
...
...
spec/requests/api/runners_spec.rb
View file @
d0842d20
...
@@ -658,6 +658,12 @@ describe API::Runners do
...
@@ -658,6 +658,12 @@ describe API::Runners do
expect
(
response
).
to
have_gitlab_http_status
(
403
)
expect
(
response
).
to
have_gitlab_http_status
(
403
)
end
end
it
'does not enable group runner'
do
post
api
(
"/projects/
#{
project
.
id
}
/runners"
,
user
),
runner_id:
group_runner
.
id
expect
(
response
).
to
have_http_status
(
403
)
end
context
'user is admin'
do
context
'user is admin'
do
it
'enables any specific runner'
do
it
'enables any specific runner'
do
expect
do
expect
do
...
...
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