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
b38439a3
Commit
b38439a3
authored
Apr 07, 2018
by
Kamil Trzciński
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use proper auth_scope for deploy token
parent
5bc58bac
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
lib/gitlab/auth.rb
lib/gitlab/auth.rb
+1
-1
spec/lib/gitlab/auth_spec.rb
spec/lib/gitlab/auth_spec.rb
+2
-2
No files found.
lib/gitlab/auth.rb
View file @
b38439a3
...
@@ -164,7 +164,7 @@ module Gitlab
...
@@ -164,7 +164,7 @@ module Gitlab
def
abilities_for_scopes
(
scopes
)
def
abilities_for_scopes
(
scopes
)
abilities_by_scope
=
{
abilities_by_scope
=
{
api:
full_authentication_abilities
,
api:
full_authentication_abilities
,
read_registry:
[
:
build_
read_container_image
],
read_registry:
[
:read_container_image
],
read_repository:
[
:download_code
]
read_repository:
[
:download_code
]
}
}
...
...
spec/lib/gitlab/auth_spec.rb
View file @
b38439a3
...
@@ -195,7 +195,7 @@ describe Gitlab::Auth do
...
@@ -195,7 +195,7 @@ describe Gitlab::Auth do
personal_access_token
=
create
(
:personal_access_token
,
scopes:
[
'read_registry'
])
personal_access_token
=
create
(
:personal_access_token
,
scopes:
[
'read_registry'
])
expect
(
gl_auth
).
to
receive
(
:rate_limit!
).
with
(
'ip'
,
success:
true
,
login:
''
)
expect
(
gl_auth
).
to
receive
(
:rate_limit!
).
with
(
'ip'
,
success:
true
,
login:
''
)
expect
(
gl_auth
.
find_for_git_client
(
''
,
personal_access_token
.
token
,
project:
nil
,
ip:
'ip'
)).
to
eq
(
Gitlab
::
Auth
::
Result
.
new
(
personal_access_token
.
user
,
nil
,
:personal_access_token
,
[
:
build_
read_container_image
]))
expect
(
gl_auth
.
find_for_git_client
(
''
,
personal_access_token
.
token
,
project:
nil
,
ip:
'ip'
)).
to
eq
(
Gitlab
::
Auth
::
Result
.
new
(
personal_access_token
.
user
,
nil
,
:personal_access_token
,
[
:read_container_image
]))
end
end
end
end
...
@@ -317,7 +317,7 @@ describe Gitlab::Auth do
...
@@ -317,7 +317,7 @@ describe Gitlab::Auth do
end
end
it
'succeeds when login and token are valid'
do
it
'succeeds when login and token are valid'
do
auth_success
=
Gitlab
::
Auth
::
Result
.
new
(
deploy_token
,
project
,
:deploy_token
,
[
:
build_
read_container_image
])
auth_success
=
Gitlab
::
Auth
::
Result
.
new
(
deploy_token
,
project
,
:deploy_token
,
[
:read_container_image
])
expect
(
gl_auth
).
to
receive
(
:rate_limit!
).
with
(
'ip'
,
success:
true
,
login:
login
)
expect
(
gl_auth
).
to
receive
(
:rate_limit!
).
with
(
'ip'
,
success:
true
,
login:
login
)
expect
(
gl_auth
.
find_for_git_client
(
login
,
deploy_token
.
token
,
project:
nil
,
ip:
'ip'
))
expect
(
gl_auth
.
find_for_git_client
(
login
,
deploy_token
.
token
,
project:
nil
,
ip:
'ip'
))
...
...
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