2018-08-18 07:19:57 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-03-29 22:11:36 -04:00
|
|
|
module DeployTokensHelper
|
2018-04-05 18:07:36 -04:00
|
|
|
def expand_deploy_tokens_section?(deploy_token)
|
|
|
|
deploy_token.persisted? ||
|
2018-03-29 22:11:36 -04:00
|
|
|
deploy_token.errors.present? ||
|
|
|
|
Rails.env.test?
|
|
|
|
end
|
2018-04-05 23:02:13 -04:00
|
|
|
|
2020-09-08 11:08:41 -04:00
|
|
|
def container_registry_enabled?(group_or_project)
|
2018-04-05 23:02:13 -04:00
|
|
|
Gitlab.config.registry.enabled &&
|
2020-09-08 11:08:41 -04:00
|
|
|
can?(current_user, :read_container_image, group_or_project)
|
|
|
|
end
|
|
|
|
|
|
|
|
def packages_registry_enabled?(group_or_project)
|
|
|
|
Gitlab.config.packages.enabled &&
|
|
|
|
can?(current_user, :read_package, group_or_project)
|
2018-04-06 10:30:21 -04:00
|
|
|
end
|
2018-03-29 22:11:36 -04:00
|
|
|
end
|