summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2017-04-12 09:26:16 +0000
committerLin Jen-Shin <godfat@godfat.org>2017-04-13 20:05:52 +0800
commitf4e8c965c8c1391be3801a9945088abc41f8a1d1 (patch)
treeb30e27994152edfa980b526d58697b8866436569 /app
parent353dea9f93ba6bfd3a9c27504034033f6232e74b (diff)
downloadgitlab-ce-f4e8c965c8c1391be3801a9945088abc41f8a1d1.tar.gz
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
Diffstat (limited to 'app')
-rw-r--r--app/policies/group_policy.rb1
-rw-r--r--app/views/groups/subgroups.html.haml2
2 files changed, 2 insertions, 1 deletions
diff --git a/app/policies/group_policy.rb b/app/policies/group_policy.rb
index cb58c115d54..87398303c68 100644
--- a/app/policies/group_policy.rb
+++ b/app/policies/group_policy.rb
@@ -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
diff --git a/app/views/groups/subgroups.html.haml b/app/views/groups/subgroups.html.haml
index be809083139..8f0724c0677 100644
--- a/app/views/groups/subgroups.html.haml
+++ b/app/views/groups/subgroups.html.haml
@@ -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