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
1d8d249b
Commit
1d8d249b
authored
Mar 09, 2016
by
Pablo Carranza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change API endpoint to authorized_keys
parent
1c035418
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
lib/api/internal.rb
lib/api/internal.rb
+3
-3
spec/requests/api/internal_spec.rb
spec/requests/api/internal_spec.rb
+4
-4
No files found.
lib/api/internal.rb
View file @
1d8d249b
...
...
@@ -25,7 +25,7 @@ module API
post
"/allowed"
do
status
200
actor
=
actor
=
if
params
[
:key_id
]
Key
.
find_by
(
id:
params
[
:key_id
])
elsif
params
[
:user_id
]
...
...
@@ -33,7 +33,7 @@ module API
end
project_path
=
params
[
:project
]
# Check for *.wiki repositories.
# Strip out the .wiki from the pathname before finding the
# project. This applies the correct project permissions to
...
...
@@ -55,7 +55,7 @@ module API
#
# Get a ssh key using the fingerprint
#
get
"/
ssh-key
"
do
get
"/
authorized_keys
"
do
key
=
Key
.
find_by
(
fingerprint:
params
[
:fingerprint
])
not_found!
(
"Key"
)
if
key
.
nil?
present
key
,
with:
Entities
::
SSHKey
...
...
spec/requests/api/internal_spec.rb
View file @
1d8d249b
...
...
@@ -48,10 +48,10 @@ describe API::API, api: true do
end
end
describe
"GET /internal/
ssh-key
"
do
describe
"GET /internal/
authorized_keys
"
do
context
"existing key"
do
it
"finds the key"
do
get
(
api
(
'/internal/
ssh-key
'
),
fingerprint:
key
.
fingerprint
,
secret_token:
secret_token
)
get
(
api
(
'/internal/
authorized_keys
'
),
fingerprint:
key
.
fingerprint
,
secret_token:
secret_token
)
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
json_response
[
"key"
]).
to
eq
(
key
.
key
)
...
...
@@ -60,7 +60,7 @@ describe API::API, api: true do
context
"non existing key"
do
it
"returns 404"
do
get
(
api
(
'/internal/
ssh-key
'
),
fingerprint:
"not-valid"
,
secret_token:
secret_token
)
get
(
api
(
'/internal/
authorized_keys
'
),
fingerprint:
"not-valid"
,
secret_token:
secret_token
)
expect
(
response
.
status
).
to
eq
(
404
)
end
...
...
@@ -68,7 +68,7 @@ describe API::API, api: true do
context
"partial key match"
do
it
"returns 404"
do
get
(
api
(
'/internal/
ssh-key
'
),
fingerprint:
"
#{
key
.
fingerprint
[
0
..
5
]
}
%"
,
secret_token:
secret_token
)
get
(
api
(
'/internal/
authorized_keys
'
),
fingerprint:
"
#{
key
.
fingerprint
[
0
..
5
]
}
%"
,
secret_token:
secret_token
)
expect
(
response
.
status
).
to
eq
(
404
)
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