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
5e1b82a7
Commit
5e1b82a7
authored
Jul 05, 2018
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add ability to disable manifest import
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
706e7620
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
5 deletions
+21
-5
app/controllers/application_controller.rb
app/controllers/application_controller.rb
+11
-1
app/controllers/import/manifest_controller.rb
app/controllers/import/manifest_controller.rb
+5
-0
app/views/projects/_import_project_pane.html.haml
app/views/projects/_import_project_pane.html.haml
+5
-4
No files found.
app/controllers/application_controller.rb
View file @
5e1b82a7
...
@@ -30,7 +30,13 @@ class ApplicationController < ActionController::Base
...
@@ -30,7 +30,13 @@ class ApplicationController < ActionController::Base
protect_from_forgery
with: :exception
,
prepend:
true
protect_from_forgery
with: :exception
,
prepend:
true
helper_method
:can?
helper_method
:can?
helper_method
:import_sources_enabled?
,
:github_import_enabled?
,
:gitea_import_enabled?
,
:github_import_configured?
,
:gitlab_import_enabled?
,
:gitlab_import_configured?
,
:bitbucket_import_enabled?
,
:bitbucket_import_configured?
,
:google_code_import_enabled?
,
:fogbugz_import_enabled?
,
:git_import_enabled?
,
:gitlab_project_import_enabled?
helper_method
:import_sources_enabled?
,
:github_import_enabled?
,
:gitea_import_enabled?
,
:github_import_configured?
,
:gitlab_import_enabled?
,
:gitlab_import_configured?
,
:bitbucket_import_enabled?
,
:bitbucket_import_configured?
,
:google_code_import_enabled?
,
:fogbugz_import_enabled?
,
:git_import_enabled?
,
:gitlab_project_import_enabled?
,
:manifest_import_enabled?
rescue_from
Encoding
::
CompatibilityError
do
|
exception
|
rescue_from
Encoding
::
CompatibilityError
do
|
exception
|
log_exception
(
exception
)
log_exception
(
exception
)
...
@@ -359,6 +365,10 @@ class ApplicationController < ActionController::Base
...
@@ -359,6 +365,10 @@ class ApplicationController < ActionController::Base
Gitlab
::
CurrentSettings
.
import_sources
.
include?
(
'gitlab_project'
)
Gitlab
::
CurrentSettings
.
import_sources
.
include?
(
'gitlab_project'
)
end
end
def
manifest_import_enabled?
Gitlab
::
CurrentSettings
.
import_sources
.
include?
(
'manifest'
)
end
# U2F (universal 2nd factor) devices need a unique identifier for the application
# U2F (universal 2nd factor) devices need a unique identifier for the application
# to perform authentication.
# to perform authentication.
# https://developers.yubico.com/U2F/App_ID.html
# https://developers.yubico.com/U2F/App_ID.html
...
...
app/controllers/import/manifest_controller.rb
View file @
5e1b82a7
class
Import::ManifestController
<
Import
::
BaseController
class
Import::ManifestController
<
Import
::
BaseController
before_action
:verify_import_enabled
before_action
:ensure_import_vars
,
only:
[
:create
,
:status
]
before_action
:ensure_import_vars
,
only:
[
:create
,
:status
]
def
new
def
new
...
@@ -80,4 +81,8 @@ class Import::ManifestController < Import::BaseController
...
@@ -80,4 +81,8 @@ class Import::ManifestController < Import::BaseController
.
where
(
creator_id:
current_user
)
.
where
(
creator_id:
current_user
)
.
includes
(
:import_state
)
.
includes
(
:import_state
)
end
end
def
verify_import_enabled
render_404
unless
manifest_import_enabled?
end
end
end
app/views/projects/_import_project_pane.html.haml
View file @
5e1b82a7
...
@@ -38,13 +38,14 @@
...
@@ -38,13 +38,14 @@
=
link_to
new_import_gitea_path
,
class:
'btn import_gitea'
do
=
link_to
new_import_gitea_path
,
class:
'btn import_gitea'
do
=
custom_icon
(
'go_logo'
)
=
custom_icon
(
'go_logo'
)
Gitea
Gitea
-
if
git_import_enabled?
%div
%div
-
if
git_import_enabled?
%button
.btn.js-toggle-button.js-import-git-toggle-button
{
type:
"button"
,
data:
{
toggle_open_class:
'active'
}
}
%button
.btn.js-toggle-button.js-import-git-toggle-button
{
type:
"button"
,
data:
{
toggle_open_class:
'active'
}
}
=
icon
(
'git'
,
text:
'Repo by URL'
)
=
icon
(
'git'
,
text:
'Repo by URL'
)
%div
%div
-
if
manifest_import_enabled?
%button
.btn
{
type:
"button"
}
%button
.btn
{
type:
"button"
}
=
icon
(
'
git
'
,
text:
'Manifest file'
)
=
icon
(
'
file
'
,
text:
'Manifest file'
)
.js-toggle-content.toggle-import-form
{
class:
(
'hide'
if
active_tab
!=
'import'
)
}
.js-toggle-content.toggle-import-form
{
class:
(
'hide'
if
active_tab
!=
'import'
)
}
=
form_for
@project
,
html:
{
class:
'new_project'
}
do
|
f
|
=
form_for
@project
,
html:
{
class:
'new_project'
}
do
|
f
|
...
...
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