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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
a09e1d3d
Commit
a09e1d3d
authored
Aug 29, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable import/export back for non-admins
parent
71345998
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
7 additions
and
9 deletions
+7
-9
CHANGELOG
CHANGELOG
+1
-0
app/controllers/import/gitlab_projects_controller.rb
app/controllers/import/gitlab_projects_controller.rb
+0
-5
app/views/projects/new.html.haml
app/views/projects/new.html.haml
+1
-1
doc/user/project/settings/import_export.md
doc/user/project/settings/import_export.md
+2
-1
features/steps/dashboard/new_project.rb
features/steps/dashboard/new_project.rb
+1
-0
spec/features/projects/import_export/import_file_spec.rb
spec/features/projects/import_export/import_file_spec.rb
+2
-2
No files found.
CHANGELOG
View file @
a09e1d3d
...
@@ -20,6 +20,7 @@ v 8.13.0 (unreleased)
...
@@ -20,6 +20,7 @@ v 8.13.0 (unreleased)
- Close open merge request without source project (Katarzyna Kobierska Ula Budziszewska)
- Close open merge request without source project (Katarzyna Kobierska Ula Budziszewska)
- Use a ConnectionPool for Rails.cache on Sidekiq servers
- Use a ConnectionPool for Rails.cache on Sidekiq servers
- Replace `alias_method_chain` with `Module#prepend`
- Replace `alias_method_chain` with `Module#prepend`
- Enable GitLab Import/Export for non-admin users.
- Preserve label filters when sorting !6136 (Joseph Frazier)
- Preserve label filters when sorting !6136 (Joseph Frazier)
- Only update issuable labels if they have been changed
- Only update issuable labels if they have been changed
- Take filters in account in issuable counters. !6496
- Take filters in account in issuable counters. !6496
...
...
app/controllers/import/gitlab_projects_controller.rb
View file @
a09e1d3d
class
Import::GitlabProjectsController
<
Import
::
BaseController
class
Import::GitlabProjectsController
<
Import
::
BaseController
before_action
:verify_gitlab_project_import_enabled
before_action
:verify_gitlab_project_import_enabled
before_action
:authenticate_admin!
def
new
def
new
@namespace_id
=
project_params
[
:namespace_id
]
@namespace_id
=
project_params
[
:namespace_id
]
...
@@ -48,8 +47,4 @@ class Import::GitlabProjectsController < Import::BaseController
...
@@ -48,8 +47,4 @@ class Import::GitlabProjectsController < Import::BaseController
:path
,
:namespace_id
,
:file
:path
,
:namespace_id
,
:file
)
)
end
end
def
authenticate_admin!
render_404
unless
current_user
.
is_admin?
end
end
end
app/views/projects/new.html.haml
View file @
a09e1d3d
...
@@ -72,7 +72,7 @@
...
@@ -72,7 +72,7 @@
=
link_to
"#"
,
class:
'btn js-toggle-button import_git'
do
=
link_to
"#"
,
class:
'btn js-toggle-button import_git'
do
=
icon
(
'git'
,
text:
'Repo by URL'
)
=
icon
(
'git'
,
text:
'Repo by URL'
)
%div
{
class:
'import_gitlab_project'
}
%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
=
link_to
new_import_gitlab_project_path
,
class:
'btn btn_import_gitlab_project project-submit'
do
=
icon
(
'gitlab'
,
text:
'GitLab export'
)
=
icon
(
'gitlab'
,
text:
'GitLab export'
)
...
...
doc/user/project/settings/import_export.md
View file @
a09e1d3d
...
@@ -7,7 +7,8 @@
...
@@ -7,7 +7,8 @@
> that of the exporter.
> that of the exporter.
> - For existing installations, the project import option has to be enabled in
> - For existing installations, the project import option has to be enabled in
> application settings (`/admin/application_settings`) under 'Import sources'.
> 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
> - You can find some useful raketasks if you are an administrator in the
> [import_export](../../../administration/raketasks/project_import_export.md)
> [import_export](../../../administration/raketasks/project_import_export.md)
> raketask.
> raketask.
...
...
features/steps/dashboard/new_project.rb
View file @
a09e1d3d
...
@@ -20,6 +20,7 @@ class Spinach::Features::NewProject < Spinach::FeatureSteps
...
@@ -20,6 +20,7 @@ class Spinach::Features::NewProject < Spinach::FeatureSteps
expect
(
page
).
to
have_link
(
'GitLab.com'
)
expect
(
page
).
to
have_link
(
'GitLab.com'
)
expect
(
page
).
to
have_link
(
'Google Code'
)
expect
(
page
).
to
have_link
(
'Google Code'
)
expect
(
page
).
to
have_link
(
'Repo by URL'
)
expect
(
page
).
to
have_link
(
'Repo by URL'
)
expect
(
page
).
to
have_link
(
'GitLab export'
)
end
end
step
'I click on "Import project from GitHub"'
do
step
'I click on "Import project from GitHub"'
do
...
...
spec/features/projects/import_export/import_file_spec.rb
View file @
a09e1d3d
...
@@ -86,14 +86,14 @@ feature 'Import/Export - project import integration test', feature: true, js: tr
...
@@ -86,14 +86,14 @@ feature 'Import/Export - project import integration test', feature: true, js: tr
login_as
(
normal_user
)
login_as
(
normal_user
)
end
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
expect
(
Project
.
all
.
count
).
to
be_zero
visit
new_project_path
visit
new_project_path
fill_in
:project_path
,
with:
'test-project-path'
,
visible:
true
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
end
end
...
...
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