BigW Consortium Gitlab

groups_finder.rb 361 Bytes
Newer Older
1
class GroupsFinder < UnionFinder
2 3 4
  def execute(current_user = nil)
    segments = all_groups(current_user)

5
    find_union(segments, Group).order_id_desc
6 7 8 9 10
  end

  private

  def all_groups(current_user)
11 12 13 14
    groups = []

    groups << current_user.authorized_groups if current_user
    groups << Group.unscoped.public_to_user(current_user)
Felipe Artur committed
15

16
    groups
Felipe Artur committed
17
  end
18
end