Class: GroupFinder

Inherits:
Object
  • Object
show all
Includes:
Gitlab::Allowable
Defined in:
app/finders/group_finder.rb

Instance Method Summary collapse

Methods included from Gitlab::Allowable

#can?

Constructor Details

#initialize(current_user) ⇒ GroupFinder

Returns a new instance of GroupFinder.



6
7
8
# File 'app/finders/group_finder.rb', line 6

def initialize(current_user)
  @current_user = current_user
end

Instance Method Details

#execute(*params) ⇒ Object

rubocop: disable CodeReuse/ActiveRecord



11
12
13
14
15
16
17
18
19
# File 'app/finders/group_finder.rb', line 11

def execute(*params)
  group = Group.find_by(*params)

  if can?(@current_user, :read_group, group)
    group
  else
    nil
  end
end