summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-07-28 19:30:34 +0200
committerRémy Coutable <remy@rymai.me>2016-09-22 15:50:47 +0200
commitb3f0a82f501ce26717a6f9e57d91cb2b1f1a967b (patch)
treed4eabb5b40c1140fd6619084ff11e849d44eb7db /lib
parent8071dc83fa00361b7bdee6e76ef2d4a59851b154 (diff)
downloadgitlab-ce-b3f0a82f501ce26717a6f9e57d91cb2b1f1a967b.tar.gz
New Members::ApproveAccessRequestService
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'lib')
-rw-r--r--lib/api/access_requests.rb7
1 files changed, 1 insertions, 6 deletions
diff --git a/lib/api/access_requests.rb b/lib/api/access_requests.rb
index 29a97ccbd75..9d1d9058996 100644
--- a/lib/api/access_requests.rb
+++ b/lib/api/access_requests.rb
@@ -55,13 +55,8 @@ module API
put ':id/access_requests/:user_id/approve' do
required_attributes! [:user_id]
source = find_source(source_type, params[:id])
- authorize_admin_source!(source_type, source)
- member = source.requesters.find_by!(user_id: params[:user_id])
- if params[:access_level]
- member.update(access_level: params[:access_level])
- end
- member.accept_request
+ member = ::Members::ApproveAccessRequestService.new(source, current_user, params).execute
status :created
present member.user, with: Entities::Member, member: member