blob: e30722efc13b02b819023d394b1c48204b294fb0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
module Members
class RequestAccessService < Members::BaseService
def execute
raise Gitlab::Access::AccessDeniedError unless can_request_access?(source)
source.members.create(
access_level: Gitlab::Access::DEVELOPER,
user: current_user,
requested_at: Time.now.utc)
end
private
def can_request_access?(source)
source && can?(current_user, :request_access, source)
end
end
end
|