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
Tatuya Kamada
gitlab-ce
Commits
562de2a4
Commit
562de2a4
authored
Mar 07, 2013
by
Sebastian Ziebell
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into api/system_hooks_adjustments
parents
32f1eaaf
a7055be1
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
28 deletions
+52
-28
lib/api/internal.rb
lib/api/internal.rb
+3
-0
spec/requests/api/internal_spec.rb
spec/requests/api/internal_spec.rb
+49
-28
No files found.
lib/api/internal.rb
View file @
562de2a4
...
@@ -20,6 +20,9 @@ module Gitlab
...
@@ -20,6 +20,9 @@ module Gitlab
project
==
key
.
project
&&
git_cmd
==
'git-upload-pack'
project
==
key
.
project
&&
git_cmd
==
'git-upload-pack'
else
else
user
=
key
.
user
user
=
key
.
user
return
false
if
user
.
blocked?
action
=
case
git_cmd
action
=
case
git_cmd
when
'git-upload-pack'
when
'git-upload-pack'
then
:download_code
then
:download_code
...
...
spec/requests/api/internal_spec.rb
View file @
562de2a4
...
@@ -34,13 +34,7 @@ describe Gitlab::API do
...
@@ -34,13 +34,7 @@ describe Gitlab::API do
context
"git pull"
do
context
"git pull"
do
it
do
it
do
get
(
pull
(
key
,
project
)
api
(
"/internal/allowed"
),
ref:
'master'
,
key_id:
key
.
id
,
project:
project
.
path_with_namespace
,
action:
'git-upload-pack'
)
response
.
status
.
should
==
200
response
.
status
.
should
==
200
response
.
body
.
should
==
'true'
response
.
body
.
should
==
'true'
...
@@ -49,13 +43,7 @@ describe Gitlab::API do
...
@@ -49,13 +43,7 @@ describe Gitlab::API do
context
"git push"
do
context
"git push"
do
it
do
it
do
get
(
push
(
key
,
project
)
api
(
"/internal/allowed"
),
ref:
'master'
,
key_id:
key
.
id
,
project:
project
.
path_with_namespace
,
action:
'git-receive-pack'
)
response
.
status
.
should
==
200
response
.
status
.
should
==
200
response
.
body
.
should
==
'true'
response
.
body
.
should
==
'true'
...
@@ -70,13 +58,33 @@ describe Gitlab::API do
...
@@ -70,13 +58,33 @@ describe Gitlab::API do
context
"git pull"
do
context
"git pull"
do
it
do
it
do
get
(
pull
(
key
,
project
)
api
(
"/internal/allowed"
),
ref:
'master'
,
response
.
status
.
should
==
200
key_id:
key
.
id
,
response
.
body
.
should
==
'false'
project:
project
.
path_with_namespace
,
end
action:
'git-upload-pack'
end
)
context
"git push"
do
it
do
push
(
key
,
project
)
response
.
status
.
should
==
200
response
.
body
.
should
==
'false'
end
end
end
context
"blocked user"
do
let
(
:personal_project
)
{
create
(
:project
,
namespace:
user
.
namespace
)
}
before
do
user
.
block
end
context
"git pull"
do
it
do
pull
(
key
,
personal_project
)
response
.
status
.
should
==
200
response
.
status
.
should
==
200
response
.
body
.
should
==
'false'
response
.
body
.
should
==
'false'
...
@@ -85,19 +93,32 @@ describe Gitlab::API do
...
@@ -85,19 +93,32 @@ describe Gitlab::API do
context
"git push"
do
context
"git push"
do
it
do
it
do
push
(
key
,
personal_project
)
response
.
status
.
should
==
200
response
.
body
.
should
==
'false'
end
end
end
end
def
pull
(
key
,
project
)
get
(
get
(
api
(
"/internal/allowed"
),
api
(
"/internal/allowed"
),
ref:
'master'
,
ref:
'master'
,
key_id:
key
.
id
,
key_id:
key
.
id
,
project:
project
.
path_with_namespace
,
project:
project
.
path_with_namespace
,
action:
'git-receive
-pack'
action:
'git-upload
-pack'
)
)
response
.
status
.
should
==
200
response
.
body
.
should
==
'false'
end
end
end
end
def
push
(
key
,
project
)
get
(
api
(
"/internal/allowed"
),
ref:
'master'
,
key_id:
key
.
id
,
project:
project
.
path_with_namespace
,
action:
'git-receive-pack'
)
end
end
end
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