diff options
-rw-r--r-- | app/services/members/request_access_service.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/app/services/members/request_access_service.rb b/app/services/members/request_access_service.rb index 5c0d2d83445..2614153d900 100644 --- a/app/services/members/request_access_service.rb +++ b/app/services/members/request_access_service.rb @@ -8,7 +8,7 @@ module Members end def execute - raise Gitlab::Access::AccessDeniedError if cannot_request_access?(source) + raise Gitlab::Access::AccessDeniedError unless can_request_access?(source) source.members.create( access_level: Gitlab::Access::DEVELOPER, @@ -18,8 +18,8 @@ module Members private - def cannot_request_access?(source) - !source || !can?(current_user, :request_access, source) + def can_request_access?(source) + source && can?(current_user, :request_access, source) end end end |