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
diff options
context:
space:
mode:
Diffstat (limited to 'lib/api/users.rb')
-rw-r--r--lib/api/users.rb61
1 files changed, 2 insertions, 59 deletions
diff --git a/lib/api/users.rb b/lib/api/users.rb
index ff36a4cfe95..fff0e9fee06 100644
--- a/lib/api/users.rb
+++ b/lib/api/users.rb
@@ -6,7 +6,7 @@ module API
include APIGuard
include Helpers::CustomAttributes
- allow_access_with_scope :read_user, if: -> (request) { request.get? || request.head? }
+ allow_access_with_scope :read_user, if: ->(request) { request.get? || request.head? }
feature_category :user_profile,
%w[
@@ -134,7 +134,7 @@ module API
entity = current_user&.can_read_all_resources? ? Entities::UserWithAdmin : Entities::UserBasic
if entity == Entities::UserWithAdmin
- users = users.preload(:identities, :webauthn_registrations, :namespace, :followers, :followees, :user_preference)
+ users = users.preload(:identities, :webauthn_registrations, :namespace, :followers, :followees, :user_preference, :user_detail)
end
users, options = with_custom_attributes(users, { with: entity, current_user: current_user })
@@ -1369,63 +1369,6 @@ module API
get 'status', feature_category: :user_profile do
present current_user.status || {}, with: Entities::UserStatus
end
-
- desc 'Create a runner owned by currently authenticated user' do
- detail 'Create a new runner'
- success Entities::Ci::RunnerRegistrationDetails
- failure [[400, 'Bad Request'], [403, 'Forbidden']]
- tags %w[user runners]
- end
- params do
- requires :runner_type, type: String, values: ::Ci::Runner.runner_types.keys,
- desc: %q(Specifies the scope of the runner)
- given runner_type: ->(runner_type) { runner_type == 'group_type' } do
- requires :group_id, type: Integer,
- desc: 'The ID of the group that the runner is created in',
- documentation: { example: 1 }
- end
- given runner_type: ->(runner_type) { runner_type == 'project_type' } do
- requires :project_id, type: Integer,
- desc: 'The ID of the project that the runner is created in',
- documentation: { example: 1 }
- end
- optional :description, type: String, desc: %q(Description of the runner)
- optional :maintenance_note, type: String,
- desc: %q(Free-form maintenance notes for the runner (1024 characters))
- optional :paused, type: Boolean, desc: 'Specifies if the runner should ignore new jobs (defaults to false)'
- optional :locked, type: Boolean,
- desc: 'Specifies if the runner should be locked for the current project (defaults to false)'
- optional :access_level, type: String, values: ::Ci::Runner.access_levels.keys,
- desc: 'The access level of the runner'
- optional :run_untagged, type: Boolean,
- desc: 'Specifies if the runner should handle untagged jobs (defaults to true)'
- optional :tag_list, type: Array[String], coerce_with: ::API::Validations::Types::CommaSeparatedToArray.coerce,
- desc: %q(A list of runner tags)
- optional :maximum_timeout, type: Integer,
- desc: 'Maximum timeout that limits the amount of time (in seconds) that runners can run jobs'
- end
- post 'runners', urgency: :low, feature_category: :runner_fleet do
- attributes = attributes_for_keys(
- %i[runner_type group_id project_id description maintenance_note paused locked run_untagged tag_list
- access_level maximum_timeout]
- )
-
- case attributes[:runner_type]
- when 'group_type'
- attributes[:scope] = ::Group.find_by_id(attributes.delete(:group_id))
- when 'project_type'
- attributes[:scope] = ::Project.find_by_id(attributes.delete(:project_id))
- end
-
- result = ::Ci::Runners::CreateRunnerService.new(user: current_user, params: attributes).execute
- if result.error?
- message = result.errors.to_sentence
- forbidden!(message) if result.reason == :forbidden
- bad_request!(message)
- end
-
- present result.payload[:runner], with: Entities::Ci::RunnerRegistrationDetails
- end
end
end
end