diff options
Diffstat (limited to 'lib/sidebars')
-rw-r--r-- | lib/sidebars/groups/menus/ci_cd_menu.rb | 4 | ||||
-rw-r--r-- | lib/sidebars/groups/menus/settings_menu.rb | 14 | ||||
-rw-r--r-- | lib/sidebars/projects/menus/infrastructure_menu.rb | 2 | ||||
-rw-r--r-- | lib/sidebars/projects/menus/issues_menu.rb | 6 |
4 files changed, 21 insertions, 5 deletions
diff --git a/lib/sidebars/groups/menus/ci_cd_menu.rb b/lib/sidebars/groups/menus/ci_cd_menu.rb index f5bce57f496..a1f98b918e6 100644 --- a/lib/sidebars/groups/menus/ci_cd_menu.rb +++ b/lib/sidebars/groups/menus/ci_cd_menu.rb @@ -34,10 +34,8 @@ module Sidebars ) end - # TODO Proper policies, such as `read_group_runners`, should be implemented per - # See https://gitlab.com/gitlab-org/gitlab/-/issues/334802 def show_runners? - can?(context.current_user, :admin_group, context.group) && + can?(context.current_user, :read_group_runners, context.group) && Feature.enabled?(:runner_list_group_view_vue_ui, context.group, default_enabled: :yaml) end end diff --git a/lib/sidebars/groups/menus/settings_menu.rb b/lib/sidebars/groups/menus/settings_menu.rb index f0239ca6a1a..810b467ed2d 100644 --- a/lib/sidebars/groups/menus/settings_menu.rb +++ b/lib/sidebars/groups/menus/settings_menu.rb @@ -10,6 +10,7 @@ module Sidebars add_item(general_menu_item) add_item(integrations_menu_item) + add_item(access_tokens_menu_item) add_item(group_projects_menu_item) add_item(repository_menu_item) add_item(ci_cd_menu_item) @@ -56,6 +57,19 @@ module Sidebars ) end + def access_tokens_menu_item + unless can?(context.current_user, :read_resource_access_tokens, context.group) + return ::Sidebars::NilMenuItem.new(item_id: :access_tokens) + end + + ::Sidebars::MenuItem.new( + title: _('Access Tokens'), + link: group_settings_access_tokens_path(context.group), + active_routes: { path: 'access_tokens#index' }, + item_id: :access_tokens + ) + end + def group_projects_menu_item ::Sidebars::MenuItem.new( title: _('Projects'), diff --git a/lib/sidebars/projects/menus/infrastructure_menu.rb b/lib/sidebars/projects/menus/infrastructure_menu.rb index 1018bdd545b..060a5be5f57 100644 --- a/lib/sidebars/projects/menus/infrastructure_menu.rb +++ b/lib/sidebars/projects/menus/infrastructure_menu.rb @@ -100,7 +100,7 @@ module Sidebars ::Sidebars::MenuItem.new( title: _('Google Cloud'), link: project_google_cloud_index_path(context.project), - active_routes: { controller: [:google_cloud, :service_accounts] }, + active_routes: { controller: [:google_cloud, :service_accounts, :deployments] }, item_id: :google_cloud ) end diff --git a/lib/sidebars/projects/menus/issues_menu.rb b/lib/sidebars/projects/menus/issues_menu.rb index 3774bec2f13..51eea3d850d 100644 --- a/lib/sidebars/projects/menus/issues_menu.rb +++ b/lib/sidebars/projects/menus/issues_menu.rb @@ -8,7 +8,7 @@ module Sidebars override :configure_menu_items def configure_menu_items - return unless can?(context.current_user, :read_issue, context.project) + return false unless show_issues_menu_items? add_item(list_menu_item) add_item(boards_menu_item) @@ -70,6 +70,10 @@ module Sidebars private + def show_issues_menu_items? + can?(context.current_user, :read_issue, context.project) + end + def list_menu_item ::Sidebars::MenuItem.new( title: _('List'), |