Commit 59f81b4f authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'siemens/gitlab-ce-fix/subgroup-hide-button' into 'master'

Hide new subgroup button if user has no permission to create one

Closes #30139

See merge request !10627
parents c43f7d47 0424f3fa
No related merge requests found
......@@ -28,6 +28,7 @@ class GroupPolicy < BasePolicy
can! :admin_namespace
can! :admin_group_member
can! :change_visibility_level
can! :create_subgroup if @user.can_create_group
end
if globally_viewable && @subject.request_access_enabled && !member
......
......@@ -9,7 +9,7 @@
.nav-controls
= form_tag request.path, method: :get do |f|
= search_field_tag :filter_groups, params[:filter_groups], placeholder: 'Filter by name', class: 'form-control', spellcheck: false
- if can? current_user, :admin_group, @group
- if can?(current_user, :create_subgroup, @group)
= link_to new_group_path(parent_id: @group.id), class: 'btn btn-new pull-right' do
New Subgroup
......
---
title: Hide new subgroup button if user has no permission to create one
merge_request: 10627
author:
......@@ -22,7 +22,8 @@ describe GroupPolicy, models: true do
:admin_group,
:admin_namespace,
:admin_group_member,
:change_visibility_level
:change_visibility_level,
:create_subgroup
]
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment