Class: Projects::DeployTokens::RevokeService
- Inherits:
-
BaseProjectService
- Object
- BaseContainerService
- BaseProjectService
- Projects::DeployTokens::RevokeService
- Defined in:
- app/services/projects/deploy_tokens/revoke_service.rb
Instance Attribute Summary collapse
-
#source ⇒ Object
Returns the value of attribute source.
-
#token ⇒ Object
Returns the value of attribute token.
Attributes inherited from BaseProjectService
Attributes inherited from BaseContainerService
#container, #current_user, #group, #params, #project
Instance Method Summary collapse
Methods inherited from BaseProjectService
Methods inherited from BaseContainerService
#group_container?, #initialize, #namespace_container?, #project_container?, #project_group, #root_ancestor
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 BaseProjectService
Instance Attribute Details
#source ⇒ Object
Returns the value of attribute source.
6 7 8 |
# File 'app/services/projects/deploy_tokens/revoke_service.rb', line 6 def source @source end |
#token ⇒ Object
Returns the value of attribute token.
6 7 8 |
# File 'app/services/projects/deploy_tokens/revoke_service.rb', line 6 def token @token end |
Instance Method Details
#execute ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'app/services/projects/deploy_tokens/revoke_service.rb', line 8 def execute return ServiceResponse.error(message: 'Unauthorized to revoke project deploy token') unless can_revoke_token? @token = project.deploy_tokens.find(params[:id]) token.revoke! ServiceResponse.success(message: 'Token was revoked') rescue ActiveRecord::RecordNotFound, ActiveRecord::RecordInvalid, ActiveRecord::RecordNotSaved ServiceResponse.error(message: 'Token was not revoked') end |