Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib/api
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2018-06-26 12:36:54 +0300
committerKamil Trzciński <ayufan@ayufan.eu>2018-06-26 16:53:09 +0300
commitca93faf15f822cbf3eda5e87d4aaaaa81d413a8b (patch)
tree39dec7f4ac7269ae2a30d22e15584b4b3385b144 /lib/api
parent7da7af3a22058a6fb4e22cbf2b659e910cc92d54 (diff)
Remove the use of `is_shared` of `Ci::Runner`
Diffstat (limited to 'lib/api')
-rw-r--r--lib/api/entities.rb4
-rw-r--r--lib/api/runner.rb6
-rw-r--r--lib/api/runners.rb4
3 files changed, 7 insertions, 7 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index bb48a86fe9e..d04f92885a3 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -1010,7 +1010,7 @@ module API
expose :description
expose :ip_address
expose :active
- expose :is_shared
+ expose :instance_type?, as: :is_shared
expose :name
expose :online?, as: :online
expose :status
@@ -1024,7 +1024,7 @@ module API
expose :access_level
expose :version, :revision, :platform, :architecture
expose :contacted_at
- expose :token, if: lambda { |runner, options| options[:current_user].admin? || !runner.is_shared? }
+ expose :token, if: lambda { |runner, options| options[:current_user].admin? || !runner.instance_type? }
expose :projects, with: Entities::BasicProjectDetails do |runner, options|
if options[:current_user].admin?
runner.projects
diff --git a/lib/api/runner.rb b/lib/api/runner.rb
index 96a02914faa..b4b984f7b8f 100644
--- a/lib/api/runner.rb
+++ b/lib/api/runner.rb
@@ -24,13 +24,13 @@ module API
attributes =
if runner_registration_token_valid?
# Create shared runner. Requires admin access
- attributes.merge(is_shared: true, runner_type: :instance_type)
+ attributes.merge(runner_type: :instance_type)
elsif project = Project.find_by(runners_token: params[:token])
# Create a specific runner for the project
- attributes.merge(is_shared: false, runner_type: :project_type, projects: [project])
+ attributes.merge(runner_type: :project_type, projects: [project])
elsif group = Group.find_by(runners_token: params[:token])
# Create a specific runner for the group
- attributes.merge(is_shared: false, runner_type: :group_type, groups: [group])
+ attributes.merge(runner_type: :group_type, groups: [group])
else
forbidden!
end
diff --git a/lib/api/runners.rb b/lib/api/runners.rb
index 2b78075ddbf..6443e88e806 100644
--- a/lib/api/runners.rb
+++ b/lib/api/runners.rb
@@ -119,7 +119,7 @@ module API
use :pagination
end
get ':id/runners' do
- runners = filter_runners(Ci::Runner.owned_or_shared(user_project.id), params[:scope])
+ runners = filter_runners(Ci::Runner.owned_or_instance_wide(user_project.id), params[:scope])
present paginate(runners), with: Entities::Runner
end
@@ -180,7 +180,7 @@ module API
end
def authenticate_show_runner!(runner)
- return if runner.is_shared || current_user.admin?
+ return if runner.instance_type? || current_user.admin?
forbidden!("No access granted") unless can?(current_user, :read_runner, runner)
end