Class: Namespaces::Projects::InvitedGroupsFinder

Inherits:
Object
  • Object
show all
Includes:
Gitlab::Allowable, GroupsFilter
Defined in:
app/finders/namespaces/projects/invited_groups_finder.rb

Instance Method Summary collapse

Methods included from Gitlab::Allowable

#can?, #can_all?, #can_any?

Constructor Details

#initialize(project, current_user = nil, params = {}) ⇒ InvitedGroupsFinder

Returns a new instance of InvitedGroupsFinder.



20
21
22
23
24
# File 'app/finders/namespaces/projects/invited_groups_finder.rb', line 20

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

Instance Method Details

#executeObject



26
27
28
29
30
31
32
# File 'app/finders/namespaces/projects/invited_groups_finder.rb', line 26

def execute
  return Group.none unless can?(current_user, :read_project, project)

  groups = group_links(include_relations).public_or_visible_to_user(current_user)
  groups = apply_filters(groups)
  sort(groups).with_route
end