debian-mirror-gitlab/app/finders/projects_finder.rb

19 lines
381 B
Ruby
Raw Normal View History

2016-06-02 11:05:42 +05:30
class ProjectsFinder < UnionFinder
2015-11-26 14:37:03 +05:30
def execute(current_user = nil, options = {})
2016-06-02 11:05:42 +05:30
segments = all_projects(current_user)
2014-09-02 18:07:02 +05:30
2016-06-02 11:05:42 +05:30
find_union(segments, Project)
2014-09-02 18:07:02 +05:30
end
private
def all_projects(current_user)
2016-06-02 11:05:42 +05:30
projects = []
2015-11-26 14:37:03 +05:30
2016-06-02 11:05:42 +05:30
projects << current_user.authorized_projects if current_user
projects << Project.unscoped.public_to_user(current_user)
2015-11-26 14:37:03 +05:30
2016-06-02 11:05:42 +05:30
projects
2015-11-26 14:37:03 +05:30
end
2014-09-02 18:07:02 +05:30
end