Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2017-06-07 12:20:57 +0300
committerKamil Trzciński <ayufan@ayufan.eu>2017-06-07 12:20:57 +0300
commit7adddf49965a1808e7a3a0d1a70b08172c74a762 (patch)
tree326fd31a0b2ac01fd31d71b0d2e9146d363bb967 /app/controllers
parentdddc54aa0aea4088e5a233d18a62cb2435590fe9 (diff)
parent9fcc3e5982311a380681c822df72fe470a5ea1ca (diff)
Merge branch 'zj-read-registry-pat' into 'master'
Allow pulling container images using personal access tokens Closes #19219 See merge request !11845
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/jwt_controller.rb6
-rw-r--r--app/controllers/profiles/personal_access_tokens_controller.rb2
2 files changed, 5 insertions, 3 deletions
diff --git a/app/controllers/jwt_controller.rb b/app/controllers/jwt_controller.rb
index 1c01be06451..c585d26df77 100644
--- a/app/controllers/jwt_controller.rb
+++ b/app/controllers/jwt_controller.rb
@@ -25,8 +25,10 @@ class JwtController < ApplicationController
authenticate_with_http_basic do |login, password|
@authentication_result = Gitlab::Auth.find_for_git_client(login, password, project: nil, ip: request.ip)
- render_unauthorized unless @authentication_result.success? &&
- (@authentication_result.actor.nil? || @authentication_result.actor.is_a?(User))
+ if @authentication_result.failed? ||
+ (@authentication_result.actor.present? && !@authentication_result.actor.is_a?(User))
+ render_unauthorized
+ end
end
rescue Gitlab::Auth::MissingPersonalTokenError
render_missing_personal_token
diff --git a/app/controllers/profiles/personal_access_tokens_controller.rb b/app/controllers/profiles/personal_access_tokens_controller.rb
index 0abe7ea3c9b..f748d191ef4 100644
--- a/app/controllers/profiles/personal_access_tokens_controller.rb
+++ b/app/controllers/profiles/personal_access_tokens_controller.rb
@@ -38,7 +38,7 @@ class Profiles::PersonalAccessTokensController < Profiles::ApplicationController
end
def set_index_vars
- @scopes = Gitlab::Auth::API_SCOPES
+ @scopes = Gitlab::Auth::AVAILABLE_SCOPES
@personal_access_token = finder.build
@inactive_personal_access_tokens = finder(state: 'inactive').execute