Class: Ci::JobToken::ExportAuthorizationsService
- Inherits:
-
Object
- Object
- Ci::JobToken::ExportAuthorizationsService
- Includes:
- Gitlab::Allowable
- Defined in:
- app/services/ci/job_token/export_authorizations_service.rb
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(current_user:, accessed_project:) ⇒ ExportAuthorizationsService
constructor
A new instance of ExportAuthorizationsService.
Methods included from Gitlab::Allowable
Constructor Details
#initialize(current_user:, accessed_project:) ⇒ ExportAuthorizationsService
Returns a new instance of ExportAuthorizationsService.
9 10 11 12 |
# File 'app/services/ci/job_token/export_authorizations_service.rb', line 9 def initialize(current_user:, accessed_project:) @current_user = current_user @accessed_project = accessed_project end |
Instance Method Details
#execute ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'app/services/ci/job_token/export_authorizations_service.rb', line 14 def execute unless can?(current_user, :admin_project, accessed_project) return ServiceResponse.error(message: _('Access denied'), reason: :forbidden) end csv_data = CsvBuilder.new(, header_to_value_hash).render ServiceResponse.success(payload: { data: csv_data, filename: csv_filename }) end |