diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-08-30 14:34:37 -0300 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-08-31 16:54:15 -0300 |
commit | e293ffd48fb16c8ad15c066cfbbe1dcead7c52e0 (patch) | |
tree | 629ff34656b234911843e0230cdbe330731b05ea /app/controllers/import/gitlab_controller.rb | |
parent | 325de662ce79ea75348c303e05b2f0045835193e (diff) | |
download | gitlab-ce-e293ffd48fb16c8ad15c066cfbbe1dcead7c52e0.tar.gz |
Refactoring Import::BaseController#find_or_create_namespace
Diffstat (limited to 'app/controllers/import/gitlab_controller.rb')
-rw-r--r-- | app/controllers/import/gitlab_controller.rb | 8 |
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 |