summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2016-10-03 11:45:01 +0000
committerRobert Speicher <robert@gitlab.com>2016-10-03 11:45:01 +0000
commit8c5701b622a12ebc79a88e65baaf29549c5be1da (patch)
treee29cb2579b1e8f4930b9132d8020879ef3b64851
parent71fe23c1bf7ec0cc875db3caf4f4046aa5f32c0f (diff)
parenta09e1d3dda57323d8932b498a711928c98404005 (diff)
downloadgitlab-ce-8c5701b622a12ebc79a88e65baaf29549c5be1da.tar.gz
Merge branch 'fix/import-export-admin' into 'master'
Enable Import/Export for non-admin users Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/21315 Related https://gitlab.com/gitlab-org/gitlab-ce/issues/20857 and https://gitlab.com/gitlab-org/gitlab-ce/issues/20821/ See merge request !6080
-rw-r--r--CHANGELOG1
-rw-r--r--app/controllers/import/gitlab_projects_controller.rb5
-rw-r--r--app/views/projects/new.html.haml2
-rw-r--r--doc/user/project/settings/import_export.md3
-rw-r--r--features/steps/dashboard/new_project.rb1
-rw-r--r--spec/features/projects/import_export/import_file_spec.rb4
6 files changed, 7 insertions, 9 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 3849683a35e..7ffc74f4ec0 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -21,6 +21,7 @@ v 8.13.0 (unreleased)
- Close open merge request without source project (Katarzyna Kobierska Ula Budziszewska)
- Use a ConnectionPool for Rails.cache on Sidekiq servers
- Replace `alias_method_chain` with `Module#prepend`
+ - Enable GitLab Import/Export for non-admin users.
- Preserve label filters when sorting !6136 (Joseph Frazier)
- Only update issuable labels if they have been changed
- Take filters in account in issuable counters. !6496
diff --git a/app/controllers/import/gitlab_projects_controller.rb b/app/controllers/import/gitlab_projects_controller.rb
index 7d0eff37635..3ec173abcdb 100644
--- a/app/controllers/import/gitlab_projects_controller.rb
+++ b/app/controllers/import/gitlab_projects_controller.rb
@@ -1,6 +1,5 @@
class Import::GitlabProjectsController < Import::BaseController
before_action :verify_gitlab_project_import_enabled
- before_action :authenticate_admin!
def new
@namespace_id = project_params[:namespace_id]
@@ -48,8 +47,4 @@ class Import::GitlabProjectsController < Import::BaseController
:path, :namespace_id, :file
)
end
-
- def authenticate_admin!
- render_404 unless current_user.is_admin?
- end
end
diff --git a/app/views/projects/new.html.haml b/app/views/projects/new.html.haml
index fda0592dd41..cc8cb134fb8 100644
--- a/app/views/projects/new.html.haml
+++ b/app/views/projects/new.html.haml
@@ -72,7 +72,7 @@
= link_to "#", class: 'btn js-toggle-button import_git' do
= icon('git', text: 'Repo by URL')
%div{ class: 'import_gitlab_project' }
- - if gitlab_project_import_enabled? && current_user.is_admin?
+ - if gitlab_project_import_enabled?
= link_to new_import_gitlab_project_path, class: 'btn btn_import_gitlab_project project-submit' do
= icon('gitlab', text: 'GitLab export')
diff --git a/doc/user/project/settings/import_export.md b/doc/user/project/settings/import_export.md
index 445c0ee8333..65ed9fae4ec 100644
--- a/doc/user/project/settings/import_export.md
+++ b/doc/user/project/settings/import_export.md
@@ -7,7 +7,8 @@
> that of the exporter.
> - For existing installations, the project import option has to be enabled in
> application settings (`/admin/application_settings`) under 'Import sources'.
-> You will have to be an administrator to enable and use the import functionality.
+> Ask your administrator if you don't see the **GitLab export** button when
+> creating a new project.
> - You can find some useful raketasks if you are an administrator in the
> [import_export](../../../administration/raketasks/project_import_export.md)
> raketask.
diff --git a/features/steps/dashboard/new_project.rb b/features/steps/dashboard/new_project.rb
index 2f0941e4113..cb36d6ae1a9 100644
--- a/features/steps/dashboard/new_project.rb
+++ b/features/steps/dashboard/new_project.rb
@@ -20,6 +20,7 @@ class Spinach::Features::NewProject < Spinach::FeatureSteps
expect(page).to have_link('GitLab.com')
expect(page).to have_link('Google Code')
expect(page).to have_link('Repo by URL')
+ expect(page).to have_link('GitLab export')
end
step 'I click on "Import project from GitHub"' do
diff --git a/spec/features/projects/import_export/import_file_spec.rb b/spec/features/projects/import_export/import_file_spec.rb
index 09cd6369881..f32834801a0 100644
--- a/spec/features/projects/import_export/import_file_spec.rb
+++ b/spec/features/projects/import_export/import_file_spec.rb
@@ -86,14 +86,14 @@ feature 'Import/Export - project import integration test', feature: true, js: tr
login_as(normal_user)
end
- scenario 'non-admin user is not allowed to import a project' do
+ scenario 'non-admin user is allowed to import a project' do
expect(Project.all.count).to be_zero
visit new_project_path
fill_in :project_path, with: 'test-project-path', visible: true
- expect(page).not_to have_content('GitLab export')
+ expect(page).to have_content('GitLab export')
end
end