diff options
author | Rémy Coutable <remy@rymai.me> | 2016-09-22 15:50:24 +0200 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-09-22 15:50:48 +0200 |
commit | 94996963c594b673f8c380e3e06fd3fbdd1ce105 (patch) | |
tree | 0fa92eaad52be926bd2f67738545ade235901eb0 /app/services/members | |
parent | 5dcdf1d51bbd5bde4ea9417dd4402571608c90f0 (diff) | |
download | gitlab-ce-94996963c594b673f8c380e3e06fd3fbdd1ce105.tar.gz |
Inverse condition in Members::ApproveAccessRequestServicerc-new-members-approve-request-access-service
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'app/services/members')
-rw-r--r-- | app/services/members/approve_access_request_service.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/app/services/members/approve_access_request_service.rb b/app/services/members/approve_access_request_service.rb index c05d061b6a0..416aee2ab51 100644 --- a/app/services/members/approve_access_request_service.rb +++ b/app/services/members/approve_access_request_service.rb @@ -14,7 +14,7 @@ module Members condition = params[:user_id] ? { user_id: params[:user_id] } : { id: params[:id] } access_requester = source.requesters.find_by!(condition) - raise Gitlab::Access::AccessDeniedError if cannot_update_access_requester?(access_requester) + raise Gitlab::Access::AccessDeniedError unless can_update_access_requester?(access_requester) access_requester.access_level = params[:access_level] if params[:access_level] access_requester.accept_request @@ -24,8 +24,8 @@ module Members private - def cannot_update_access_requester?(access_requester) - !access_requester || !can?(current_user, action_member_permission(:update, access_requester), access_requester) + def can_update_access_requester?(access_requester) + access_requester && can?(current_user, action_member_permission(:update, access_requester), access_requester) end end end |