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
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
11 deletions
+8
-11
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
No files found.
app/models/container_repository.rb
View file @
3bfc05be
...
@@ -58,11 +58,4 @@ class ContainerRepository < ActiveRecord::Base
...
@@ -58,11 +58,4 @@ class ContainerRepository < ActiveRecord::Base
client
.
delete_repository_tag
(
self
.
path
,
digest
)
client
.
delete_repository_tag
(
self
.
path
,
digest
)
end
end
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
end
app/services/auth/container_registry_authentication_service.rb
View file @
3bfc05be
...
@@ -56,13 +56,15 @@ module Auth
...
@@ -56,13 +56,15 @@ module Auth
def
process_scope
(
scope
)
def
process_scope
(
scope
)
type
,
name
,
actions
=
scope
.
split
(
':'
,
3
)
type
,
name
,
actions
=
scope
.
split
(
':'
,
3
)
actions
=
actions
.
split
(
','
)
actions
=
actions
.
split
(
','
)
path
=
ContainerRegistry
::
Path
.
new
(
name
)
return
unless
type
==
'repository'
return
unless
type
==
'repository'
process_repository_access
(
type
,
name
,
actions
)
process_repository_access
(
type
,
path
,
actions
)
end
end
def
process_repository_access
(
type
,
name
,
actions
)
def
process_repository_access
(
type
,
path
,
actions
)
requested_project
=
ContainerRepository
.
project_from_path
(
name
)
requested_project
=
path
.
repository_project
return
unless
requested_project
return
unless
requested_project
...
@@ -70,7 +72,9 @@ module Auth
...
@@ -70,7 +72,9 @@ module Auth
can_access?
(
requested_project
,
action
)
can_access?
(
requested_project
,
action
)
end
end
{
type:
type
,
name:
name
,
actions:
actions
}
if
actions
.
present?
return
unless
actions
.
present?
{
type:
type
,
name:
path
.
to_s
,
actions:
actions
}
end
end
def
can_access?
(
requested_project
,
requested_action
)
def
can_access?
(
requested_project
,
requested_action
)
...
...
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