summaryrefslogtreecommitdiff
path: root/app/controllers/import/gitlab_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/import/gitlab_controller.rb')
-rw-r--r--app/controllers/import/gitlab_controller.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/app/controllers/import/gitlab_controller.rb b/app/controllers/import/gitlab_controller.rb
index bc967e55ab1..73837ffbe67 100644
--- a/app/controllers/import/gitlab_controller.rb
+++ b/app/controllers/import/gitlab_controller.rb
@@ -27,9 +27,13 @@ class Import::GitlabController < Import::BaseController
@repo_id = params[:repo_id].to_i
repo = client.project(@repo_id)
@project_name = repo['name']
- namespace = find_or_create_namespace(repo['namespace']['path'], client.user['username']) || (render and return)
+ @target_namespace = find_or_create_namespace(repo['namespace']['path'], client.user['username'])
- @project = Gitlab::GitlabImport::ProjectCreator.new(repo, namespace, current_user, access_params).execute
+ if current_user.can?(:create_projects, @target_namespace)
+ @project = Gitlab::GitlabImport::ProjectCreator.new(repo, @target_namespace, current_user, access_params).execute
+ else
+ render 'unauthorized'
+ end
end
private