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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
b2acb3c7
Commit
b2acb3c7
authored
Oct 10, 2017
by
Vratislav Kalenda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor access handling
parent
3b95f588
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
5 deletions
+12
-5
app/services/auth/container_registry_authentication_service.rb
...ervices/auth/container_registry_authentication_service.rb
+12
-5
No files found.
app/services/auth/container_registry_authentication_service.rb
View file @
b2acb3c7
...
...
@@ -56,15 +56,22 @@ module Auth
def
process_scope
(
scope
)
type
,
name
,
actions
=
scope
.
split
(
':'
,
3
)
actions
=
actions
.
split
(
','
)
path
=
ContainerRegistry
::
Path
.
new
(
name
)
if
type
==
'registry'
&&
name
==
'catalog'
&&
current_user
&&
current_user
.
admin?
return
{
type:
type
,
name:
name
,
actions:
[
'*'
]
}
case
type
when
'registry'
process_registry_access
(
type
,
name
,
actions
)
when
'repository'
path
=
ContainerRegistry
::
Path
.
new
(
name
)
process_repository_access
(
type
,
path
,
actions
)
end
end
return
unless
type
==
'repository'
def
process_registry_access
(
type
,
name
,
actions
)
return
unless
current_user
&
.
admin?
return
unless
name
==
'catalog'
return
unless
actions
==
[
'*'
]
process_repository_access
(
type
,
path
,
actions
)
{
type:
type
,
name:
name
,
actions:
[
'*'
]
}
end
def
process_repository_access
(
type
,
path
,
actions
)
...
...
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