Class: Ci::Runners::RunnerCreationStrategies::GroupRunnerStrategy
- Inherits:
-
Object
- Object
- Ci::Runners::RunnerCreationStrategies::GroupRunnerStrategy
- Includes:
- Gitlab::Utils::StrongMemoize
- Defined in:
- app/services/ci/runners/runner_creation_strategies/group_runner_strategy.rb
Instance Method Summary collapse
- #authorized_user? ⇒ Boolean
-
#initialize(user:, params:) ⇒ GroupRunnerStrategy
constructor
A new instance of GroupRunnerStrategy.
- #normalize_params ⇒ Object
- #validate_params ⇒ Object
Constructor Details
#initialize(user:, params:) ⇒ GroupRunnerStrategy
Returns a new instance of GroupRunnerStrategy.
9 10 11 12 |
# File 'app/services/ci/runners/runner_creation_strategies/group_runner_strategy.rb', line 9 def initialize(user:, params:) @user = user @params = params end |
Instance Method Details
#authorized_user? ⇒ Boolean
23 24 25 |
# File 'app/services/ci/runners/runner_creation_strategies/group_runner_strategy.rb', line 23 def user.present? && user.can?(:create_runner, scope) end |
#normalize_params ⇒ Object
14 15 16 17 |
# File 'app/services/ci/runners/runner_creation_strategies/group_runner_strategy.rb', line 14 def normalize_params params[:runner_type] = 'group_type' params[:groups] = [scope] end |
#validate_params ⇒ Object
19 20 21 |
# File 'app/services/ci/runners/runner_creation_strategies/group_runner_strategy.rb', line 19 def validate_params _('Missing/invalid scope') unless scope.present? end |