diff options
author | GitLab <gitlab@localhost> | 2013-01-17 17:35:57 +0200 |
---|---|---|
committer | GitLab <gitlab@localhost> | 2013-01-17 17:35:57 +0200 |
commit | 232d61d59808e6f0c731d135d728800c4b13ae27 (patch) | |
tree | 87356bbbd97abd549fcc489fb3bed60dc0438528 /app/helpers/namespaces_helper.rb | |
parent | c7c1a97c2fecb8931bbe66af6860a072ca97335d (diff) | |
download | gitlab-ce-232d61d59808e6f0c731d135d728800c4b13ae27.tar.gz |
Refactor project creation. Added logout link to profile page
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]} ] |