Use allowlist of allowed attributes for imported models

This change changes the behavior that is reponsible for filtering out
attributes when importing new project. We were cleaning attributes based
on list of excluded patterns and attributes. For ProtectedBranch,
ProtectedTag, ProtectedEnvironment and Releases we are changing that
behavior.

Changelog: changed
parent 72981f3d
......@@ -9,8 +9,11 @@ RSpec.describe Gitlab::ImportExport::AttributesPermitter do
let(:attributes_permitter) { described_class.new }
where(:relation_name, :permitted_attributes_defined) do
:push_rule | true
:issuable_sla | false
:push_rule | true
:issuable_sla | false
:unprotect_access_levels | true
:deploy_access_levels | true
:protected_environments | true
end
with_them do
......
......@@ -225,6 +225,53 @@ included_attributes:
- :updated_at
- :start_date
- :state
protected_branches:
- :project_id
- :name
- :created_at
- :updated_at
- :code_owner_approval_required
- :allow_force_push
protected_tags:
- :project_id
- :name
- :created_at
- :updated_at
create_access_levels:
- :access_level
- :created_at
- :updated_at
- :user_id
- :group_id
merge_access_levels:
- :access_level
- :created_at
- :updated_at
- :user_id
- :group_id
push_access_levels:
- :access_level
- :created_at
- :updated_at
- :user_id
- :group_id
releases:
- :tag
- :description
- :project_id
- :author_id
- :created_at
- :updated_at
- :name
- :sha
- :released_at
links:
- :url
- :name
- :created_at
- :updated_at
- :filepath
- :link_type
# Do not include the following attributes for the models specified.
excluded_attributes:
......@@ -593,3 +640,20 @@ ee:
- :reject_unsigned_commits
- :commit_committer_check
- :regexp_uses_re2
unprotect_access_levels:
- :access_level
- :user_id
- :group_id
deploy_access_levels:
- :created_at
- :updated_at
- :access_level
- :user_id
- :group_id
protected_environments:
- :project_id
- :group_id
- :name
- :created_at
- :updated_at
......@@ -92,6 +92,13 @@ RSpec.describe Gitlab::ImportExport::AttributesPermitter do
:boards | true
:custom_attributes | true
:labels | true
:protected_branches | true
:protected_tags | true
:create_access_levels | true
:merge_access_levels | true
:push_access_levels | true
:releases | true
:links | true
end
with_them 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