Commit e48313f709e8d99e954a98bc569cfaccd65efa4d

Authored by Dmitriy Zaporozhets
2 parents b490fded 39090482

Merge branch 'api_token_cast' of /home/git/repositories/gitlab/gitlabhq into 6-2-stable

VERSION
1   -6.2.3
  1 +6.2.4
... ...
lib/api/helpers.rb
... ... @@ -6,19 +6,23 @@ module API
6 6 SUDO_PARAM = :sudo
7 7  
8 8 def current_user
9   - @current_user ||= User.find_by_authentication_token(params[PRIVATE_TOKEN_PARAM] || env[PRIVATE_TOKEN_HEADER])
  9 + private_token = (params[PRIVATE_TOKEN_PARAM] || env[PRIVATE_TOKEN_HEADER]).to_s
  10 + @current_user ||= User.find_by_authentication_token(private_token)
10 11 identifier = sudo_identifier()
  12 +
11 13 # If the sudo is the current user do nothing
12 14 if (identifier && !(@current_user.id == identifier || @current_user.username == identifier))
13 15 render_api_error!('403 Forbidden: Must be admin to use sudo', 403) unless @current_user.is_admin?
14 16 @current_user = User.by_username_or_id(identifier)
15 17 not_found!("No user id or username for: #{identifier}") if @current_user.nil?
16 18 end
  19 +
17 20 @current_user
18 21 end
19 22  
20 23 def sudo_identifier()
21 24 identifier ||= params[SUDO_PARAM] ||= env[SUDO_HEADER]
  25 +
22 26 # Regex for integers
23 27 if (!!(identifier =~ /^[0-9]+$/))
24 28 identifier.to_i
... ... @@ -29,6 +33,7 @@ module API
29 33  
30 34 def set_current_user_for_thread
31 35 Thread.current[:current_user] = current_user
  36 +
32 37 begin
33 38 yield
34 39 ensure
... ...
lib/tasks/gitlab/check.rake
... ... @@ -736,7 +736,7 @@ namespace :gitlab do
736 736 end
737 737  
738 738 def check_gitlab_shell
739   - required_version = Gitlab::VersionInfo.new(1, 7, 4)
  739 + required_version = Gitlab::VersionInfo.new(1, 7, 8)
740 740 current_version = Gitlab::VersionInfo.parse(gitlab_shell_version)
741 741  
742 742 print "GitLab Shell version >= #{required_version} ? ... "
... ...