debian-mirror-gitlab/app/finders/projects_finder.rb
2016-06-02 11:05:42 +05:30

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