Class: Gitlab::Audit::CiRunnerTokenAuthor
- Inherits:
-
NullAuthor
- Object
- NullAuthor
- Gitlab::Audit::CiRunnerTokenAuthor
- Defined in:
- lib/gitlab/audit/ci_runner_token_author.rb
Instance Attribute Summary collapse
-
#entity_path ⇒ Object
readonly
Returns the value of attribute entity_path.
-
#entity_type ⇒ Object
readonly
Returns the value of attribute entity_type.
Attributes inherited from NullAuthor
Instance Method Summary collapse
- #full_path ⇒ Object
-
#initialize(entity_type:, entity_path:, runner_authentication_token: nil, runner_registration_token: nil) ⇒ CiRunnerTokenAuthor
constructor
Represents a CI Runner token (registration or authentication).
Methods inherited from NullAuthor
#current_sign_in_ip, for, #impersonated?, #to_global_id
Constructor Details
#initialize(entity_type:, entity_path:, runner_authentication_token: nil, runner_registration_token: nil) ⇒ CiRunnerTokenAuthor
Represents a CI Runner token (registration or authentication)
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/gitlab/audit/ci_runner_token_author.rb', line 15 def initialize(entity_type:, entity_path:, runner_authentication_token: nil, runner_registration_token: nil) name = if runner_authentication_token.present? "Authentication token: #{runner_authentication_token}" elsif runner_registration_token.present? "Registration token: #{runner_registration_token}" else "Token not available" end super(id: -1, name: name) @entity_type = entity_type @entity_path = entity_path end |
Instance Attribute Details
#entity_path ⇒ Object (readonly)
Returns the value of attribute entity_path.
6 7 8 |
# File 'lib/gitlab/audit/ci_runner_token_author.rb', line 6 def entity_path @entity_path end |
#entity_type ⇒ Object (readonly)
Returns the value of attribute entity_type.
6 7 8 |
# File 'lib/gitlab/audit/ci_runner_token_author.rb', line 6 def entity_type @entity_type end |
Instance Method Details
#full_path ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/gitlab/audit/ci_runner_token_author.rb', line 31 def full_path url_helpers = ::Gitlab::Routing.url_helpers case @entity_type when 'Group' url_helpers.group_runners_path(@entity_path) when 'Project' project = Project.find_by_full_path(@entity_path) url_helpers.project_settings_ci_cd_path(project, anchor: 'js-runners-settings') if project else url_helpers.admin_runners_path end end |