summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2018-02-05 17:44:23 +0800
committerLin Jen-Shin <godfat@godfat.org>2018-02-05 17:44:23 +0800
commitbd132dfe72ba6c083e696dfc20ce895f6e5021c3 (patch)
tree06cb2b8f0f06d2a1a99c01a46689a4aafc9764a6
parentcf887a8b3108edb715ee5618377f4ffab1824d85 (diff)
downloadgitlab-ce-bd132dfe72ba6c083e696dfc20ce895f6e5021c3.tar.gz
Make find_user_from_sources extensible for EE
-rw-r--r--lib/api/api_guard.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/api/api_guard.rb b/lib/api/api_guard.rb
index 9aeebc34525..c2113551207 100644
--- a/lib/api/api_guard.rb
+++ b/lib/api/api_guard.rb
@@ -42,7 +42,7 @@ module API
include Gitlab::Auth::UserAuthFinders
def find_current_user!
- user = find_user_from_access_token || find_user_from_warden
+ user = find_user_from_sources
return unless user
forbidden!('User is blocked') unless Gitlab::UserAccess.new(user).allowed? && user.can?(:access_api)
@@ -50,6 +50,10 @@ module API
user
end
+ def find_user_from_sources
+ find_user_from_access_token || find_user_from_warden
+ end
+
private
# An array of scopes that were registered (using `allow_access_with_scope`)