List all groups/projects for admins on explore pages
This commit is contained in:
parent
87cdb156ce
commit
ffcbc63693
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue