Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
3bfc05be
Commit
3bfc05be
authored
Mar 29, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use container repository path inside auth service
parent
06bae003
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
13 deletions
+10
-13
app/models/container_repository.rb
app/models/container_repository.rb
+0
-7
app/services/auth/container_registry_authentication_service.rb
...ervices/auth/container_registry_authentication_service.rb
+8
-4
spec/lib/container_registry/path_spec.rb
spec/lib/container_registry/path_spec.rb
+2
-2
No files found.
app/models/container_repository.rb
View file @
3bfc05be
...
...
@@ -58,11 +58,4 @@ class ContainerRepository < ActiveRecord::Base
client
.
delete_repository_tag
(
self
.
path
,
digest
)
end
end
# TODO, we will return a new ContainerRepository object here
#
def
self
.
project_from_path
(
repository_path
)
ContainerRegistry
::
Path
.
new
(
repository_path
)
.
repository_project
end
end
app/services/auth/container_registry_authentication_service.rb
View file @
3bfc05be
...
...
@@ -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
)
...
...
spec/lib/container_registry/path_spec.rb
View file @
3bfc05be
...
...
@@ -9,8 +9,8 @@ describe ContainerRegistry::Path do
it
'return all project-like components in reverse order'
do
expect
(
subject
.
components
).
to
eq
%w[path/to/some/project
path/to/some
path/to]
path/to/some
path/to]
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment