Class: Mutations::Ci::JobTokenScope::AddProject
- Inherits:
-
BaseMutation
- Object
- GraphQL::Schema::RelayClassicMutation
- BaseMutation
- Mutations::Ci::JobTokenScope::AddProject
- Includes:
- FindsProject
- Defined in:
- app/graphql/mutations/ci/job_token_scope/add_project.rb
Constant Summary
Constants inherited from BaseMutation
Constants included from Gitlab::Graphql::Authorize::AuthorizeResource
Gitlab::Graphql::Authorize::AuthorizeResource::ConfigurationError, Gitlab::Graphql::Authorize::AuthorizeResource::RESOURCE_ACCESS_ERROR
Instance Method Summary collapse
Methods inherited from BaseMutation
#api_user?, authorization, authorized?, authorizes_object?, #current_user, #errors_on_object, #load_application_object, #ready?
Methods included from Gitlab::Graphql::Authorize::AuthorizeResource
#authorize!, #authorized_find!, #authorized_resource?, #find_object, #raise_resource_not_available_error!
Methods included from Gitlab::Graphql::GlobalIDCompatibility
Instance Method Details
#resolve(project_path:, target_project_path:) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'app/graphql/mutations/ci/job_token_scope/add_project.rb', line 26 def resolve(project_path:, target_project_path:) project = (project_path) target_project = Project.find_by_full_path(target_project_path) result = ::Ci::JobTokenScope::AddProjectService .new(project, current_user) .execute(target_project) if result.success? { ci_job_token_scope: ::Ci::JobToken::Scope.new(project), errors: [] } else { ci_job_token_scope: nil, errors: [result.] } end end |