diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2019-01-24 16:51:26 +0300 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2019-01-24 17:04:13 +0300 |
commit | 69f173ceab50896de90ec19e2f82e9b3ce609aa4 (patch) | |
tree | f91449fa9bf685ec1d190b1fb7d27c53a40d1a60 /lib | |
parent | b8c23dbb8e75918bad6dddada4c21212936bba56 (diff) |
Merge branch 'security-import-project-visibility-11-6' into 'security-11-6'
[11.6] Fix Imported Project Retains Prior Visibility Setting
See merge request gitlab/gitlabhq!2853
(cherry picked from commit 348a5dbc905cac1d61158e9fb83b82185a27cb04)
aaca3d2b Fix tree restorer visibility level
1d942ad1 Update schema file
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/import_export/project_tree_restorer.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/gitlab/import_export/project_tree_restorer.rb b/lib/gitlab/import_export/project_tree_restorer.rb index a56ec65b9f1..51001750a6c 100644 --- a/lib/gitlab/import_export/project_tree_restorer.rb +++ b/lib/gitlab/import_export/project_tree_restorer.rb @@ -107,7 +107,7 @@ module Gitlab def project_params @project_params ||= begin - attrs = json_params.merge(override_params) + attrs = json_params.merge(override_params).merge(visibility_level) # Cleaning all imported and overridden params Gitlab::ImportExport::AttributeCleaner.clean(relation_hash: attrs, @@ -127,6 +127,13 @@ module Gitlab end end + def visibility_level + level = override_params['visibility_level'] || json_params['visibility_level'] || @project.visibility_level + level = @project.group.visibility_level if @project.group && level > @project.group.visibility_level + + { 'visibility_level' => level } + end + # Given a relation hash containing one or more models and its relationships, # loops through each model and each object from a model type and # and assigns its correspondent attributes hash from +tree_hash+ |