gitlab-org--gitlab-foss/app/finders/projects_finder.rb
2016-03-20 21:04:07 +01:00

18 lines
381 B
Ruby

class ProjectsFinder < UnionFinder
def execute(current_user = nil, options = {})
segments = all_projects(current_user)
find_union(segments, Project)
end
private
def all_projects(current_user)
projects = []
projects << current_user.authorized_projects if current_user
projects << Project.unscoped.public_to_user(current_user)
projects
end
end