summaryrefslogtreecommitdiff
path: root/app/controllers/import/bulk_imports_controller.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-01-18 19:00:14 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2023-01-18 19:00:14 +0000
commit05f0ebba3a2c8ddf39e436f412dc2ab5bf1353b2 (patch)
tree11d0f2a6ec31c7793c184106cedc2ded3d9a2cc5 /app/controllers/import/bulk_imports_controller.rb
parentec73467c23693d0db63a797d10194da9e72a74af (diff)
downloadgitlab-ce-05f0ebba3a2c8ddf39e436f412dc2ab5bf1353b2.tar.gz
Add latest changes from gitlab-org/gitlab@15-8-stable-eev15.8.0-rc42
Diffstat (limited to 'app/controllers/import/bulk_imports_controller.rb')
-rw-r--r--app/controllers/import/bulk_imports_controller.rb23
1 files changed, 20 insertions, 3 deletions
diff --git a/app/controllers/import/bulk_imports_controller.rb b/app/controllers/import/bulk_imports_controller.rb
index 9a7118ce498..e9705c45116 100644
--- a/app/controllers/import/bulk_imports_controller.rb
+++ b/app/controllers/import/bulk_imports_controller.rb
@@ -3,8 +3,11 @@
class Import::BulkImportsController < ApplicationController
include ActionView::Helpers::SanitizeHelper
- before_action :ensure_group_import_enabled
+ before_action :ensure_bulk_import_enabled
before_action :verify_blocked_uri, only: :status
+ before_action only: :status do
+ push_frontend_feature_flag(:bulk_import_projects)
+ end
feature_category :importers
urgency :low
@@ -17,6 +20,9 @@ class Import::BulkImportsController < ApplicationController
session[access_token_key] = configure_params[access_token_key]&.strip
session[url_key] = configure_params[url_key]
+ verify_blocked_uri && performed? && return
+ validate_configure_params!
+
redirect_to status_import_bulk_imports_url(namespace_id: params[:namespace_id])
end
@@ -100,6 +106,16 @@ class Import::BulkImportsController < ApplicationController
params.permit(access_token_key, url_key)
end
+ def validate_configure_params!
+ client = BulkImports::Clients::HTTP.new(
+ url: credentials[:url],
+ token: credentials[:access_token]
+ )
+
+ client.validate_instance_version!
+ client.validate_import_scopes!
+ end
+
def create_params
params.permit(bulk_import: bulk_import_params)[:bulk_import]
end
@@ -115,11 +131,12 @@ class Import::BulkImportsController < ApplicationController
destination_name
destination_slug
destination_namespace
+ migrate_projects
]
end
- def ensure_group_import_enabled
- render_404 unless ::BulkImports::Features.enabled?
+ def ensure_bulk_import_enabled
+ render_404 unless Gitlab::CurrentSettings.bulk_import_enabled?
end
def access_token_key