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:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-03-29 14:01:48 +0300
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-03-29 14:02:46 +0300
commit3bfc05be5ee5b0262857febf90fc7e1f17895d4e (patch)
tree5952d96a2b88cf55c774631d583a845307d3a932 /app/services/auth
parent06bae00365cda6930063b98fde1a9b804f2ae3bc (diff)
Use container repository path inside auth service
Diffstat (limited to 'app/services/auth')
-rw-r--r--app/services/auth/container_registry_authentication_service.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/app/services/auth/container_registry_authentication_service.rb b/app/services/auth/container_registry_authentication_service.rb
index 3d151c6a357..7a2ec9664c1 100644
--- a/app/services/auth/container_registry_authentication_service.rb
+++ b/app/services/auth/container_registry_authentication_service.rb
@@ -56,13 +56,15 @@ module Auth
def process_scope(scope)
type, name, actions = scope.split(':', 3)
actions = actions.split(',')
+ path = ContainerRegistry::Path.new(name)
+
return unless type == 'repository'
- process_repository_access(type, name, actions)
+ process_repository_access(type, path, actions)
end
- def process_repository_access(type, name, actions)
- requested_project = ContainerRepository.project_from_path(name)
+ def process_repository_access(type, path, actions)
+ requested_project = path.repository_project
return unless requested_project
@@ -70,7 +72,9 @@ module Auth
can_access?(requested_project, action)
end
- { type: type, name: name, actions: actions } if actions.present?
+ return unless actions.present?
+
+ { type: type, name: path.to_s, actions: actions }
end
def can_access?(requested_project, requested_action)