Commit 34d142e5 authored by George Koltsov's avatar George Koltsov Committed by Rémy Coutable

Allow project feature permissions to be overridden during import

parent de651ce8
...@@ -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