BigW Consortium Gitlab

projects_finder.rb 381 Bytes
Newer Older
1
class ProjectsFinder < UnionFinder
2
  def execute(current_user = nil, options = {})
3
    segments = all_projects(current_user)
4

5
    find_union(segments, Project)
6 7 8 9
  end

  private

10
  def all_projects(current_user)
11
    projects = []
Zeger-Jan van de Weg committed
12

13 14
    projects << current_user.authorized_projects if current_user
    projects << Project.unscoped.public_to_user(current_user)
15

16
    projects
17
  end
18
end