Class: MembersFinder

Inherits:
Object
  • Object
show all
Defined in:
app/finders/members_finder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(project, current_user, params: {}) ⇒ MembersFinder

Returns a new instance of MembersFinder.


9
10
11
12
13
14
# File 'app/finders/members_finder.rb', line 9

def initialize(project, current_user, params: {})
  @project = project
  @group = project.group
  @current_user = current_user
  @params = params
end

Instance Attribute Details

#paramsObject (readonly)

Params can be any of the following:

sort:       string
search:     string

7
8
9
# File 'app/finders/members_finder.rb', line 7

def params
  @params
end

Instance Method Details

#can?(*args) ⇒ Boolean

Returns:

  • (Boolean)

22
23
24
# File 'app/finders/members_finder.rb', line 22

def can?(*args)
  Ability.allowed?(*args)
end

#execute(include_relations: [:inherited, :direct]) ⇒ Object


16
17
18
19
20
# File 'app/finders/members_finder.rb', line 16

def execute(include_relations: [:inherited, :direct])
  members = find_members(include_relations)

  filter_members(members)
end