Module: DeployTokensHelper

Defined in:
app/helpers/deploy_tokens_helper.rb

Instance Method Summary collapse

Instance Method Details

#container_registry_enabled?(group_or_project) ⇒ Boolean

Returns:

  • (Boolean)

10
11
12
13
# File 'app/helpers/deploy_tokens_helper.rb', line 10

def container_registry_enabled?(group_or_project)
  Gitlab.config.registry.enabled &&
    can?(current_user, :read_container_image, group_or_project)
end

#deploy_token_revoke_button_data(token:, group_or_project:) ⇒ Object


20
21
22
23
24
25
# File 'app/helpers/deploy_tokens_helper.rb', line 20

def deploy_token_revoke_button_data(token:, group_or_project:)
  {
    token: token.to_json(only: [:id, :name]),
    revoke_path: revoke_deploy_token_path(group_or_project, token)
  }
end

#expand_deploy_tokens_section?(deploy_token) ⇒ Boolean

Returns:

  • (Boolean)

4
5
6
7
8
# File 'app/helpers/deploy_tokens_helper.rb', line 4

def expand_deploy_tokens_section?(deploy_token)
  deploy_token.persisted? ||
    deploy_token.errors.present? ||
    Rails.env.test?
end

#packages_registry_enabled?(group_or_project) ⇒ Boolean

Returns:

  • (Boolean)

15
16
17
18
# File 'app/helpers/deploy_tokens_helper.rb', line 15

def packages_registry_enabled?(group_or_project)
  Gitlab.config.packages.enabled &&
    can?(current_user, :read_package, group_or_project)
end