Class: Ci::Runners::SetRunnerAssociatedProjectsService
- Inherits:
-
Object
- Object
- Ci::Runners::SetRunnerAssociatedProjectsService
- Defined in:
- app/services/ci/runners/set_runner_associated_projects_service.rb
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(runner:, current_user:, project_ids:) ⇒ SetRunnerAssociatedProjectsService
constructor
A new instance of SetRunnerAssociatedProjectsService.
Constructor Details
#initialize(runner:, current_user:, project_ids:) ⇒ SetRunnerAssociatedProjectsService
Returns a new instance of SetRunnerAssociatedProjectsService.
9 10 11 12 13 |
# File 'app/services/ci/runners/set_runner_associated_projects_service.rb', line 9 def initialize(runner:, current_user:, project_ids:) @runner = runner @current_user = current_user @project_ids = project_ids || [] end |
Instance Method Details
#execute ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'app/services/ci/runners/set_runner_associated_projects_service.rb', line 15 def execute unless current_user&.can?(:assign_runner, runner) return ServiceResponse.error(message: _('user not allowed to assign runner'), reason: :not_authorized_to_assign_runner) end set_associated_projects end |