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

19 lines
361 B
Ruby
Raw Normal View History

2016-06-02 11:05:42 +05:30
class GroupsFinder < UnionFinder
def execute(current_user = nil)
segments = all_groups(current_user)
find_union(segments, Group).order_id_desc
end
private
def all_groups(current_user)
groups = []
groups << current_user.authorized_groups if current_user
groups << Group.unscoped.public_to_user(current_user)
groups
end
end