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
Léo-Paul Géneau
gitlab-ce
Commits
e8813520
Commit
e8813520
authored
Feb 13, 2018
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor api class
parent
39122ea4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
lib/api/project_import.rb
lib/api/project_import.rb
+5
-3
No files found.
lib/api/project_import.rb
View file @
e8813520
...
@@ -13,7 +13,7 @@ module API
...
@@ -13,7 +13,7 @@ module API
end
end
before
do
before
do
not_found
!
unless
Gitlab
::
CurrentSettings
.
import_sources
.
include?
(
'gitlab_project'
)
forbidden
!
unless
Gitlab
::
CurrentSettings
.
import_sources
.
include?
(
'gitlab_project'
)
end
end
resource
:projects
,
requirements:
{
id:
%r{[^/]+}
}
do
resource
:projects
,
requirements:
{
id:
%r{[^/]+}
}
do
...
@@ -22,12 +22,14 @@ module API
...
@@ -22,12 +22,14 @@ module API
requires
:file
,
type:
File
,
desc:
'The project export file to be imported'
requires
:file
,
type:
File
,
desc:
'The project export file to be imported'
optional
:namespace
,
type:
String
,
desc:
'The ID or name of the namespace that the project will be imported into. Defaults to the user namespace.'
optional
:namespace
,
type:
String
,
desc:
'The ID or name of the namespace that the project will be imported into. Defaults to the user namespace.'
end
end
desc
'
Get export status
'
do
desc
'
Create a new project import
'
do
success
Entities
::
ProjectImportStatus
success
Entities
::
ProjectImportStatus
end
end
post
'import'
do
post
'import'
do
render_api_error!
(
'The file is invalid'
,
400
)
unless
file_is_valid?
render_api_error!
(
'The file is invalid'
,
400
)
unless
file_is_valid?
Gitlab
::
QueryLimiting
.
whitelist
(
'https://gitlab.com/gitlab-org/gitlab-ce/issues/42437'
)
namespace
=
import_params
[
:namespace
]
namespace
=
import_params
[
:namespace
]
namespace
=
if
namespace
.
blank?
namespace
=
if
namespace
.
blank?
current_user
.
namespace
current_user
.
namespace
...
@@ -49,7 +51,7 @@ module API
...
@@ -49,7 +51,7 @@ module API
params
do
params
do
requires
:id
,
type:
String
,
desc:
'The ID of a project'
requires
:id
,
type:
String
,
desc:
'The ID of a project'
end
end
desc
'Get export status'
do
desc
'Get
a project
export status'
do
success
Entities
::
ProjectImportStatus
success
Entities
::
ProjectImportStatus
end
end
get
':id/import'
do
get
':id/import'
do
...
...
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