diff options
Diffstat (limited to 'app/helpers/projects_helper.rb')
-rw-r--r-- | app/helpers/projects_helper.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index e2fd6305892..a2e9952f350 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -139,6 +139,10 @@ module ProjectsHelper project_nav_tabs.include? name end + def any_project_nav_tab?(tabs) + tabs.any? { |tab| project_nav_tab?(tab) } + end + def project_for_deploy_key(deploy_key) if deploy_key.has_access_to?(@project) @project @@ -374,6 +378,20 @@ module ProjectsHelper private + def can_read_security_configuration?(project, current_user) + ::Feature.enabled?(:secure_security_and_compliance_configuration_page_on_ce, @subject, default_enabled: :yaml) && + can?(current_user, :read_security_configuration, project) + end + + def get_project_security_nav_tabs(project, current_user) + if can_read_security_configuration?(project, current_user) + [:security_and_compliance, :security_configuration] + else + [] + end + end + + # rubocop:disable Metrics/CyclomaticComplexity def get_project_nav_tabs(project, current_user) nav_tabs = [:home] @@ -382,6 +400,8 @@ module ProjectsHelper nav_tabs << :releases if can?(current_user, :read_release, project) end + nav_tabs += get_project_security_nav_tabs(project, current_user) + if project.repo_exists? && can?(current_user, :read_merge_request, project) nav_tabs << :merge_requests end @@ -415,6 +435,7 @@ module ProjectsHelper nav_tabs end + # rubocop:enable Metrics/CyclomaticComplexity def package_nav_tabs(project, current_user) [].tap do |tabs| @@ -695,6 +716,12 @@ module ProjectsHelper "#{request.path}?#{options.to_param}" end + def sidebar_security_configuration_paths + %w[ + projects/security/configuration#show + ] + end + def sidebar_projects_paths %w[ projects#show @@ -759,6 +786,10 @@ module ProjectsHelper ] end + def sidebar_security_paths + %w[projects/security/configuration#show] + end + def user_can_see_auto_devops_implicitly_enabled_banner?(project, user) Ability.allowed?(user, :admin_project, project) && project.has_auto_devops_implicitly_enabled? && |