diff options
| author | Douwe Maan <douwe@selenight.nl> | 2017-02-06 20:32:34 -0600 |
|---|---|---|
| committer | Douwe Maan <douwe@selenight.nl> | 2017-02-06 21:02:07 -0600 |
| commit | ffcbc636930ab4d844da7677ab8439d0ede5f12f (patch) | |
| tree | 9d6cf0d26104ef2e02bda10db30bffa0e26ed3d0 | |
| parent | 87cdb156ce51a1300f833c633b802b9be5c980d0 (diff) | |
| download | gitlab-ce-ffcbc636930ab4d844da7677ab8439d0ede5f12f.tar.gz | |
List all groups/projects for admins on explore pages
| -rw-r--r-- | app/finders/group_projects_finder.rb | 2 | ||||
| -rw-r--r-- | lib/gitlab/visibility_level.rb | 14 |
2 files changed, 14 insertions, 2 deletions
diff --git a/app/finders/group_projects_finder.rb b/app/finders/group_projects_finder.rb index aa8f4c1d0e4..3b9a421b118 100644 --- a/app/finders/group_projects_finder.rb +++ b/app/finders/group_projects_finder.rb @@ -18,7 +18,7 @@ class GroupProjectsFinder < UnionFinder projects = [] if current_user - if @group.users.include?(current_user) || current_user.admin? + if @group.users.include?(current_user) projects << @group.projects unless only_shared projects << @group.shared_projects unless only_owned else diff --git a/lib/gitlab/visibility_level.rb b/lib/gitlab/visibility_level.rb index c7953af29dd..a4e966e4016 100644 --- a/lib/gitlab/visibility_level.rb +++ b/lib/gitlab/visibility_level.rb @@ -13,7 +13,19 @@ module Gitlab scope :public_and_internal_only, -> { where(visibility_level: [PUBLIC, INTERNAL] ) } scope :non_public_only, -> { where.not(visibility_level: PUBLIC) } - scope :public_to_user, -> (user) { user && !user.external ? public_and_internal_only : public_only } + scope :public_to_user, -> (user) do + if user + if user.admin? + all + elsif !user.external? + public_and_internal_only + else + public_only + end + else + public_only + end + end end PRIVATE = 0 unless const_defined?(:PRIVATE) |
