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
Boxiang Sun
gitlab-ce
Commits
35882e68
Commit
35882e68
authored
Jan 18, 2018
by
Tiago Botelho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds option to push over SSH to create a new project
parent
921d2afc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
7 deletions
+20
-7
app/controllers/projects/git_http_controller.rb
app/controllers/projects/git_http_controller.rb
+5
-5
lib/api/internal.rb
lib/api/internal.rb
+14
-1
lib/gitlab/git_access.rb
lib/gitlab/git_access.rb
+1
-1
No files found.
app/controllers/projects/git_http_controller.rb
View file @
35882e68
...
...
@@ -12,7 +12,7 @@ class Projects::GitHttpController < Projects::GitHttpClientController
log_user_activity
if
upload_pack?
if
project
.
blank?
&&
params
[
:service
]
==
'git-receive-pack'
@project
=
::
Projects
::
CreateService
.
new
(
access_acto
r
,
project_params
).
execute
@project
=
::
Projects
::
CreateService
.
new
(
use
r
,
project_params
).
execute
return
render_ok
if
@project
.
saved?
end
...
...
@@ -34,10 +34,10 @@ class Projects::GitHttpController < Projects::GitHttpClientController
def
project_params
{
description:
""
,
path:
params
[
:project_id
].
gsub
(
"
\.
git"
,
''
),
namespace_id:
namespace
.
id
.
to_s
,
visibility_level:
Gitlab
::
VisibilityLevel
::
PRIVATE
.
to_s
description:
""
,
path:
params
[
:project_id
].
gsub
(
"
\.
git"
,
''
),
namespace_id:
namespace
.
id
.
to_s
,
visibility_level:
Gitlab
::
VisibilityLevel
::
PRIVATE
.
to_s
}
end
...
...
lib/api/internal.rb
View file @
35882e68
...
...
@@ -43,7 +43,7 @@ module API
access_checker_klass
=
wiki?
?
Gitlab
::
GitAccessWiki
:
Gitlab
::
GitAccess
access_checker
=
access_checker_klass
.
new
(
actor
,
project
,
protocol
,
authentication_abilities:
ssh_authentication_abilities
,
redirected_path:
redirected_path
)
.
new
(
actor
,
project
,
protocol
,
authentication_abilities:
ssh_authentication_abilities
,
redirected_path:
redirected_path
,
target_namespace:
user
.
namespace
)
begin
access_checker
.
check
(
params
[
:action
],
params
[
:changes
])
...
...
@@ -51,6 +51,19 @@ module API
return
{
status:
false
,
message:
e
.
message
}
end
if
project
.
blank?
&&
params
[
:action
]
==
'git-receive-pack'
project_params
=
{
description:
""
,
path:
params
[
:project
].
split
(
'/'
).
last
.
gsub
(
"
\.
git"
,
''
),
namespace_id:
user
.
namespace
.
id
.
to_s
,
visibility_level:
Gitlab
::
VisibilityLevel
::
PRIVATE
.
to_s
}
@project
=
::
Projects
::
CreateService
.
new
(
user
,
project_params
).
execute
return
{
status:
false
,
message:
"Could not create project"
}
unless
@project
.
saved?
end
log_user_activity
(
actor
)
{
...
...
lib/gitlab/git_access.rb
View file @
35882e68
...
...
@@ -250,7 +250,7 @@ module Gitlab
def
can_create_project_in_namespace?
return
unless
target_namespace
acto
r
.
can?
(
:create_projects
,
target_namespace
)
use
r
.
can?
(
:create_projects
,
target_namespace
)
end
def
http?
...
...
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