Allow project feature permissions to be overridden during import
This commit is contained in:
parent
de651ce802
commit
34d142e593
3 changed files with 28 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
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
|
|||
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue