summaryrefslogtreecommitdiff
path: root/app/services/auth
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-09-15 13:49:11 +0200
committerKamil Trzcinski <ayufan@ayufan.eu>2016-09-15 13:49:11 +0200
commit9d1ccd2ad3af37139649100476b568d219343a57 (patch)
tree4475c8f777e25a3a7708ed7012f190b844fdaa7c /app/services/auth
parent50076ab974348e74514bb4f19169351f08e11636 (diff)
downloadgitlab-ce-9d1ccd2ad3af37139649100476b568d219343a57.tar.gz
Fix existing authorization specs
Diffstat (limited to 'app/services/auth')
-rw-r--r--app/services/auth/container_registry_authentication_service.rb8
1 files changed, 3 insertions, 5 deletions
diff --git a/app/services/auth/container_registry_authentication_service.rb b/app/services/auth/container_registry_authentication_service.rb
index ba0b60abfe4..df1c9b2851c 100644
--- a/app/services/auth/container_registry_authentication_service.rb
+++ b/app/services/auth/container_registry_authentication_service.rb
@@ -4,8 +4,8 @@ module Auth
AUDIENCE = 'container_registry'
- def execute(capabilities: capabilities)
- @capabilities = capabilities
+ def execute(capabilities:)
+ @capabilities = capabilities || []
return error('not found', 404) unless registry.enabled
@@ -76,7 +76,7 @@ module Auth
case requested_action
when 'pull'
- build_can_pull?(requested_project) || user_can_pull?(requested_project)
+ requested_project.public? || build_can_pull?(requested_project) || user_can_pull?(requested_project)
when 'push'
build_can_push?(requested_project) || user_can_push?(requested_project)
else
@@ -88,8 +88,6 @@ module Auth
Gitlab.config.registry
end
- private
-
def build_can_pull?(requested_project)
# Build can:
# 1. pull from it's own project (for ex. a build)