Class: Groups::AcceptingProjectSharesFinder

Inherits:
Base
  • Object
show all
Defined in:
app/finders/groups/accepting_project_shares_finder.rb

Instance Method Summary collapse

Constructor Details

#initialize(current_user, project_to_be_shared, params = {}) ⇒ AcceptingProjectSharesFinder

Returns a new instance of AcceptingProjectSharesFinder.



13
14
15
16
17
# File 'app/finders/groups/accepting_project_shares_finder.rb', line 13

def initialize(current_user, project_to_be_shared, params = {})
  @current_user = current_user
  @params = params
  @project_to_be_shared = project_to_be_shared
end

Instance Method Details

#executeObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'app/finders/groups/accepting_project_shares_finder.rb', line 19

def execute
  return Group.none unless can_share_project?

  groups = if has_admin_access?
             Group.all
           else
             groups_with_guest_access_plus
           end

  groups = by_hierarchy(groups)
  groups = by_ignorable(groups)
  groups = by_search(groups)

  sort(groups).with_route
end