From 02b85fd2366bc6c0d3194ab68e13eb6291733c26 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Thu, 15 May 2014 10:03:26 +0200 Subject: Check user access status in API for current_user --- lib/api/helpers.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib/api/helpers.rb') diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb index 7ee4b9d1381..654c1f62c6c 100644 --- a/lib/api/helpers.rb +++ b/lib/api/helpers.rb @@ -8,6 +8,11 @@ module API def current_user private_token = (params[PRIVATE_TOKEN_PARAM] || env[PRIVATE_TOKEN_HEADER]).to_s @current_user ||= User.find_by(authentication_token: private_token) + + unless @current_user && Gitlab::UserAccess.allowed?(@current_user) + return nil + end + identifier = sudo_identifier() # If the sudo is the current user do nothing -- cgit v1.2.1