BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
612b8806
Unverified
Commit
612b8806
authored
Dec 01, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix internal API for missing project or key
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
06b7907c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
7 deletions
+30
-7
internal.rb
lib/api/internal.rb
+9
-4
internal_spec.rb
spec/requests/api/internal_spec.rb
+21
-3
No files found.
lib/api/internal.rb
View file @
612b8806
...
...
@@ -33,15 +33,20 @@ module API
end
project
=
Project
.
find_with_namespace
(
project_path
)
return
false
unless
project
unless
project
return
Gitlab
::
GitAccessStatus
.
new
(
false
,
'No such project'
)
end
actor
=
if
params
[
:key_id
]
Key
.
find
(
params
[
:key_id
])
Key
.
find
_by
(
id:
params
[
:key_id
])
elsif
params
[
:user_id
]
User
.
find
(
params
[
:user_id
])
User
.
find
_by
(
id:
params
[
:user_id
])
end
return
false
unless
actor
unless
actor
return
Gitlab
::
GitAccessStatus
.
new
(
false
,
'No such user or key'
)
end
access
.
check
(
actor
,
...
...
spec/requests/api/internal_spec.rb
View file @
612b8806
...
...
@@ -26,7 +26,7 @@ describe API::API, api: true do
end
end
describe
"
GE
T /internal/allowed"
do
describe
"
POS
T /internal/allowed"
do
context
"access granted"
do
before
do
project
.
team
<<
[
user
,
:developer
]
...
...
@@ -140,7 +140,7 @@ describe API::API, api: true do
archive
(
key
,
project
)
response
.
status
.
should
==
200
response
.
body
.
should
==
'true'
JSON
.
parse
(
response
.
body
)[
"status"
].
should
be_true
end
end
...
...
@@ -149,10 +149,28 @@ describe API::API, api: true do
archive
(
key
,
project
)
response
.
status
.
should
==
200
response
.
body
.
should
==
'false'
JSON
.
parse
(
response
.
body
)[
"status"
].
should
be_false
end
end
end
context
'project does not exist'
do
it
do
pull
(
key
,
OpenStruct
.
new
(
path_with_namespace:
'gitlab/notexists'
))
response
.
status
.
should
==
200
JSON
.
parse
(
response
.
body
)[
"status"
].
should
be_false
end
end
context
'user does not exist'
do
it
do
pull
(
OpenStruct
.
new
(
id:
0
),
project
)
response
.
status
.
should
==
200
JSON
.
parse
(
response
.
body
)[
"status"
].
should
be_false
end
end
end
def
pull
(
key
,
project
)
...
...
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