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
02e66fc3
Commit
02e66fc3
authored
Mar 02, 2020
by
Aleksei Lipniagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add :authorize action to GitlabProjectsController
parent
8c6cba5b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
0 deletions
+18
-0
app/controllers/import/gitlab_projects_controller.rb
app/controllers/import/gitlab_projects_controller.rb
+18
-0
No files found.
app/controllers/import/gitlab_projects_controller.rb
View file @
02e66fc3
# frozen_string_literal: true
class
Import::GitlabProjectsController
<
Import
::
BaseController
include
WorkhorseRequest
before_action
:whitelist_query_limiting
,
only:
[
:create
]
before_action
:verify_gitlab_project_import_enabled
skip_before_action
:authenticate_user!
,
only:
[
:authorize
,
:create
]
before_action
:verify_workhorse_api!
,
only:
[
:authorize
]
def
new
@namespace
=
Namespace
.
find
(
project_params
[
:namespace_id
])
return
render_404
unless
current_user
.
can?
(
:create_projects
,
@namespace
)
...
...
@@ -28,6 +33,19 @@ class Import::GitlabProjectsController < Import::BaseController
end
end
# TODO: include UploadsActions?
def
authorize
set_workhorse_internal_api_content_type
authorized
=
ImportExportUploader
.
workhorse_authorize
(
has_length:
false
,
maximum_size:
Gitlab
::
CurrentSettings
.
max_attachment_size
.
megabytes
.
to_i
)
render
json:
authorized
rescue
SocketError
render
json:
_
(
"Error uploading file"
),
status: :internal_server_error
end
private
def
file_is_valid?
...
...
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