2018-09-11 15:08:34 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-03-28 07:09:44 -04:00
|
|
|
class GroupFinder
|
|
|
|
include Gitlab::Allowable
|
|
|
|
|
|
|
|
def initialize(current_user)
|
|
|
|
@current_user = current_user
|
|
|
|
end
|
|
|
|
|
2018-08-27 11:31:01 -04:00
|
|
|
# rubocop: disable CodeReuse/ActiveRecord
|
2017-03-28 07:09:44 -04:00
|
|
|
def execute(*params)
|
|
|
|
group = Group.find_by(*params)
|
|
|
|
|
|
|
|
if can?(@current_user, :read_group, group)
|
|
|
|
group
|
|
|
|
else
|
|
|
|
nil
|
|
|
|
end
|
|
|
|
end
|
2018-08-27 11:31:01 -04:00
|
|
|
# rubocop: enable CodeReuse/ActiveRecord
|
2017-03-28 07:09:44 -04:00
|
|
|
end
|