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
This commit is contained in:
Rémy Coutable 2017-04-12 09:26:16 +00:00
commit 59f81b4ff8
4 changed files with 8 additions and 2 deletions

View file

@ -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

View file

@ -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

View file

@ -0,0 +1,4 @@
---
title: Hide new subgroup button if user has no permission to create one
merge_request: 10627
author:

View file

@ -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