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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
34d142e5
Commit
34d142e5
authored
Aug 29, 2019
by
George Koltsov
Committed by
Rémy Coutable
Aug 29, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow project feature permissions to be overridden during import
parent
de651ce8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
0 deletions
+28
-0
app/models/project.rb
app/models/project.rb
+2
-0
changelogs/unreleased/georgekoltsov-13698-override-params.yml
...gelogs/unreleased/georgekoltsov-13698-override-params.yml
+5
-0
spec/lib/gitlab/import_export/project_tree_restorer_spec.rb
spec/lib/gitlab/import_export/project_tree_restorer_spec.rb
+21
-0
No files found.
app/models/project.rb
View file @
34d142e5
...
...
@@ -61,6 +61,8 @@ class Project < ApplicationRecord
delegate
:feature_available?
,
:builds_enabled?
,
:wiki_enabled?
,
:merge_requests_enabled?
,
:issues_enabled?
,
:pages_enabled?
,
:public_pages?
,
:merge_requests_access_level
,
:issues_access_level
,
:wiki_access_level
,
:snippets_access_level
,
:builds_access_level
,
:repository_access_level
,
to: :project_feature
,
allow_nil:
true
delegate
:base_dir
,
:disk_path
,
:ensure_storage_path_exists
,
to: :storage
...
...
changelogs/unreleased/georgekoltsov-13698-override-params.yml
0 → 100644
View file @
34d142e5
---
title
:
Allow project feature permissions to be overridden during import with override_params
merge_request
:
32348
author
:
type
:
fixed
spec/lib/gitlab/import_export/project_tree_restorer_spec.rb
View file @
34d142e5
...
...
@@ -396,6 +396,27 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do
expect
(
project
.
lfs_enabled
).
to
be_falsey
end
it
'overrides project feature access levels'
do
access_level_keys
=
project
.
project_feature
.
attributes
.
keys
.
select
{
|
a
|
a
=~
/_access_level/
}
# `pages_access_level` is not included, since it is not available in the public API
# and has a dependency on project's visibility level
# see ProjectFeature model
access_level_keys
.
delete
(
'pages_access_level'
)
disabled_access_levels
=
Hash
[
access_level_keys
.
collect
{
|
item
|
[
item
,
'disabled'
]
}]
project
.
create_import_data
(
data:
{
override_params:
disabled_access_levels
})
restored_project_json
aggregate_failures
do
access_level_keys
.
each
do
|
key
|
expect
(
project
.
public_send
(
key
)).
to
eq
(
ProjectFeature
::
DISABLED
)
end
end
end
end
context
'with a project that has a group'
do
...
...
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