blob: 140d68cfe9163c24417dace5b7abbc9df5e02100 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# frozen_string_literal: true
class AccessRequestsFinder
attr_accessor :source
# Arguments:
# source - a Group or Project
def initialize(source)
@source = source
end
def execute(...)
execute!(...)
rescue Gitlab::Access::AccessDeniedError
[]
end
def execute!(current_user)
raise Gitlab::Access::AccessDeniedError unless can_see_access_requests?(current_user)
source.namespace_requesters
end
private
def can_see_access_requests?(current_user)
source && Ability.allowed?(current_user, :admin_member_access_request, source)
end
end
|