diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 14:59:07 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 14:59:07 +0300 |
commit | 8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca (patch) | |
tree | 544930fb309b30317ae9797a9683768705d664c4 /app/helpers/projects_helper.rb | |
parent | 4b1de649d0168371549608993deac953eb692019 (diff) |
Add latest changes from gitlab-org/gitlab@13-7-stable-eev13.7.0-rc42
Diffstat (limited to 'app/helpers/projects_helper.rb')
-rw-r--r-- | app/helpers/projects_helper.rb | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index f25b229d198..80206654cd1 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -463,11 +463,12 @@ module ProjectsHelper issues: :read_issue, project_members: :read_project_member, wiki: :read_wiki, - feature_flags: :read_feature_flag + feature_flags: :read_feature_flag, + analytics: :read_analytics } end - def can_view_operations_tab?(current_user, project) + def view_operations_tab_ability [ :metrics_dashboard, :read_alert_management_alert, @@ -477,7 +478,13 @@ module ProjectsHelper :read_cluster, :read_feature_flag, :read_terraform_state - ].any? do |ability| + ] + end + + def can_view_operations_tab?(current_user, project) + return false unless project.feature_available?(:operations, current_user) + + view_operations_tab_ability.any? do |ability| can?(current_user, ability, project) end end @@ -606,6 +613,7 @@ module ProjectsHelper def project_permissions_settings(project) feature = project.project_feature + { packagesEnabled: !!project.packages_enabled, visibilityLevel: project.visibility_level, @@ -618,11 +626,14 @@ module ProjectsHelper wikiAccessLevel: feature.wiki_access_level, snippetsAccessLevel: feature.snippets_access_level, pagesAccessLevel: feature.pages_access_level, + analyticsAccessLevel: feature.analytics_access_level, containerRegistryEnabled: !!project.container_registry_enabled, lfsEnabled: !!project.lfs_enabled, emailsDisabled: project.emails_disabled?, metricsDashboardAccessLevel: feature.metrics_dashboard_access_level, - showDefaultAwardEmojis: project.show_default_award_emojis? + operationsAccessLevel: feature.operations_access_level, + showDefaultAwardEmojis: project.show_default_award_emojis?, + allowEditingCommitMessages: project.allow_editing_commit_messages? } end |