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
24eed1c5
Commit
24eed1c5
authored
Feb 10, 2016
by
Tomasz Maczukin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modify runner projects selecting method in runners API
parent
36e7ffea
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
8 deletions
+4
-8
lib/api/entities.rb
lib/api/entities.rb
+3
-3
lib/api/runners.rb
lib/api/runners.rb
+1
-5
No files found.
lib/api/entities.rb
View file @
24eed1c5
...
@@ -387,12 +387,12 @@ module API
...
@@ -387,12 +387,12 @@ module API
expose
:tag_list
expose
:tag_list
expose
:version
,
:revision
,
:platform
,
:architecture
expose
:version
,
:revision
,
:platform
,
:architecture
expose
:contacted_at
,
as: :last_contact
expose
:contacted_at
,
as: :last_contact
expose
:token
,
if:
lambda
{
|
runner
,
options
|
options
[
:
user_is_admin
]
||
!
runner
.
is_shared?
}
expose
:token
,
if:
lambda
{
|
runner
,
options
|
options
[
:
current_user
].
is_admin?
||
!
runner
.
is_shared?
}
expose
:projects
,
with:
Entities
::
RunnerProjectDetails
do
|
runner
,
options
|
expose
:projects
,
with:
Entities
::
RunnerProjectDetails
do
|
runner
,
options
|
if
options
[
:
user_is_admin
]
if
options
[
:
current_user
].
is_admin?
runner
.
projects
runner
.
projects
else
else
runner
.
projects
.
where
(
id:
options
[
:available_projects_ids
]
)
options
[
:current_user
].
authorized_projects
.
where
(
id:
runner
.
projects
)
end
end
end
end
end
end
...
...
lib/api/runners.rb
View file @
24eed1c5
...
@@ -33,11 +33,7 @@ module API
...
@@ -33,11 +33,7 @@ module API
runner
=
get_runner
(
params
[
:id
])
runner
=
get_runner
(
params
[
:id
])
authenticate_show_runner!
(
runner
)
authenticate_show_runner!
(
runner
)
available_projects_ids
=
runner
.
projects
.
select
{
|
p
|
can?
(
current_user
,
:read_project
,
p
)
}
present
runner
,
with:
Entities
::
RunnerDetails
,
current_user:
current_user
.
map
(
&
:id
)
unless
current_user
.
is_admin?
present
runner
,
with:
Entities
::
RunnerDetails
,
user_is_admin:
current_user
.
is_admin?
,
available_projects_ids:
available_projects_ids
end
end
# Update runner's details
# Update runner's details
...
...
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