Include and process visibility_level
Compare changes
This change removes the omission of the visibility_level
attribute from the file-based group export file, and adds logic to assign a visibility_level
to imported subgroups which correctly aligns with those permitted by the destination group's visibility_level
.
This change is needed because previously, with the visibility_level
attribute omitted from the export file, the visibility level for each top-level source group would be set to the same visibility as the destination group, and any source subgroups would be set to PRIVATE, regardless of their original visibility level on the source. See #405168 (closed)
Now, the source subgroup visibility_level
is maintained when it conforms to the rules for subgroup visibility levels (public
groups can contain public, internal or private subgroups, internal
groups can contain internal or private subgroups, private
groups can only contain private subgroups), or is changed to the same visibility level of the destination group.
Changelog: fixed
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
With this public source group:
The source visibility levels are maintained for each subgroup:
The allowed visibility levels are maintained for each subgroup, with the public
subgroup becoming internal
:
All subgroup visibility levels become private
:
curl --request POST --header "PRIVATE-TOKEN: [ACCESS TOKEN FOR DESTINATION INSTANCE]" \
--form "name=[NAME FOR IMPORTED GROUP]" --form "path=[PATH FOR IMPORTED GROUP]" --form "parent_id=[DESTINATION GROUP ID]" \
--form "file=@[NAME OF EXPORT FILE eg:public-group-3_export.tar.gz]" "[DESTINATION INSTANCE API ENDPOINT eg:]http://gdk.test:3000/api/v4/groups/import"
For each POST request you should see the source group and subgroups imported with the correct visibility level.
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
Related to #405168 (closed)