Commit b557145a authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'georgekoltsov/13698-override-params' into 'master'

Allow project feature permissions to be overridden during import

See merge request gitlab-org/gitlab-ce!32348
parents de651ce8 34d142e5
...@@ -61,6 +61,8 @@ class Project < ApplicationRecord ...@@ -61,6 +61,8 @@ class Project < ApplicationRecord
delegate :feature_available?, :builds_enabled?, :wiki_enabled?, delegate :feature_available?, :builds_enabled?, :wiki_enabled?,
:merge_requests_enabled?, :issues_enabled?, :pages_enabled?, :public_pages?, :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 to: :project_feature, allow_nil: true
delegate :base_dir, :disk_path, :ensure_storage_path_exists, to: :storage delegate :base_dir, :disk_path, :ensure_storage_path_exists, to: :storage
......
---
title: Allow project feature permissions to be overridden during import with override_params
merge_request: 32348
author:
type: fixed
...@@ -396,6 +396,27 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do ...@@ -396,6 +396,27 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do
expect(project.lfs_enabled).to be_falsey expect(project.lfs_enabled).to be_falsey
end 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 end
context 'with a project that has a group' do context 'with a project that has a group' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment