Class: Ci::JobTokenScope::AddGroupOrProjectService
- Inherits:
-
BaseService
- Object
- BaseService
- Ci::JobTokenScope::AddGroupOrProjectService
- Includes:
- EditScopeValidations
- Defined in:
- app/services/ci/job_token_scope/add_group_or_project_service.rb
Constant Summary
Constants included from EditScopeValidations
EditScopeValidations::NotFoundError, EditScopeValidations::TARGET_DOES_NOT_EXIST, EditScopeValidations::TARGET_GROUP_UNAUTHORIZED_OR_UNFOUND, EditScopeValidations::TARGET_PROJECT_UNAUTHORIZED_OR_UNFOUND, EditScopeValidations::ValidationError
Instance Attribute Summary
Attributes inherited from BaseService
#current_user, #params, #project
Instance Method Summary collapse
Methods included from EditScopeValidations
#validate_group_remove!, #validate_source_project_and_target_group_access!, #validate_source_project_and_target_project_access!, #validate_target_exists!
Methods inherited from BaseService
Methods included from BaseServiceUtility
#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #todo_service, #visibility_level
Methods included from Gitlab::Allowable
Constructor Details
This class inherits a constructor from BaseService
Instance Method Details
#execute(target, policies: []) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'app/services/ci/job_token_scope/add_group_or_project_service.rb', line 8 def execute(target, policies: []) validate_target_exists!(target) if target.is_a?(::Group) ::Ci::JobTokenScope::AddGroupService.new(project, current_user).execute(target, policies: policies) else ::Ci::JobTokenScope::AddProjectService.new(project, current_user).execute(target, policies: policies) end rescue EditScopeValidations::NotFoundError => e ServiceResponse.error(message: e., reason: :not_found) end |