debian-mirror-gitlab/app/services/members/request_access_service.rb

19 lines
441 B
Ruby
Raw Normal View History

2016-11-03 12:29:30 +05:30
module Members
2018-03-27 19:54:05 +05:30
class RequestAccessService < Members::BaseService
def execute(source)
2016-11-03 12:29:30 +05:30
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)
2018-03-27 19:54:05 +05:30
can?(current_user, :request_access, source)
2016-11-03 12:29:30 +05:30
end
end
end