Class: Ci::TriggerPresenter

Inherits:
Gitlab::View::Presenter::Delegated show all
Defined in:
app/presenters/ci/trigger_presenter.rb

Instance Method Summary collapse

Methods inherited from Gitlab::View::Presenter::Delegated

#initialize

Methods included from Gitlab::Utils::DelegatorOverride

#delegator_override, #delegator_override_with, #delegator_target, validator, validators, verify!

Methods included from Gitlab::View::Presenter::Base

#__subject__, #can?, #declarative_policy_delegate, #is_a?, #path_with_line_numbers, #present, #url_builder, #web_path, #web_url

Methods included from Gitlab::Allowable

#can?

Methods included from Gitlab::Routing

includes_helpers, redirect_legacy_paths, url_helpers

Constructor Details

This class inherits a constructor from Gitlab::View::Presenter::Delegated

Instance Method Details

#has_token_exposed?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'app/presenters/ci/trigger_presenter.rb', line 7

def has_token_exposed?
  can?(current_user, :admin_trigger, trigger)
end

#tokenObject



12
13
14
15
16
17
18
# File 'app/presenters/ci/trigger_presenter.rb', line 12

def token
  if has_token_exposed?
    trigger.token
  else
    trigger.short_token
  end
end