diff options
Diffstat (limited to 'app/helpers/namespaces_helper.rb')
-rw-r--r-- | app/helpers/namespaces_helper.rb | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/app/helpers/namespaces_helper.rb b/app/helpers/namespaces_helper.rb index 2d25c8f854d..6d0c6c98191 100644 --- a/app/helpers/namespaces_helper.rb +++ b/app/helpers/namespaces_helper.rb @@ -1,12 +1,13 @@ module NamespacesHelper def namespaces_options(selected = :current_user, scope = :default) - groups = current_user.owned_groups.select {|n| n.type == 'Group'} + if current_user.admin + groups = Group.all + users = Namespace.root + else + groups = current_user.owned_groups.select {|n| n.type == 'Group'} + users = current_user.namespaces.reject {|n| n.type == 'Group'} + end - users = if scope == :all - Namespace.root - else - current_user.namespaces.reject {|n| n.type == 'Group'} - end global_opts = ["Global", [['/', Namespace.global_id]] ] group_opts = ["Groups", groups.map {|g| [g.human_name, g.id]} ] |