Include and process visibility_level
-
Review changes -
-
Download -
Patches
-
Plain diff
What does this MR do and why?
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 or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
With this public source group:

Imported to a public destination group
The source visibility levels are maintained for each subgroup:

Imported to an internal destination group
The allowed visibility levels are maintained for each subgroup, with the public
subgroup becoming internal
:

Imported to a private destination group
All subgroup visibility levels become private
:

How to set up and validate locally
- On a source instance create a public group with a public, an internal, and a private subgroup.
- In the Group's Settings > General > Advanced > Export group, click the [Export Group] button
- refresh the page until the [Download Export] button appears and download the export file.
- on the destination instance create a public, internal, and private group and take note of their IIds
- In a terminal window, in the same directory as the downloaded export file, make a curl request to the destination instance to create several POST requests, using the id of each destination group just created:
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.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #405168 (closed)
Merge request reports
- latest version0e96d3db10 commits,
- version 140f06d0949 commits,
- version 13e612ed5a8 commits,
- version 12c58b37528 commits,
- version 115b3dc6977 commits,
- version 10e7fbd6306 commits,
- version 937328f696 commits,
- version 844fb03845 commits,
- version 754ace4ff5 commits,
- version 6c7b6fb905 commits,
- version 553060bdf4 commits,
- version 4503e5ee03 commits,
- version 3dc284e3e2 commits,
- version 26f6718861 commit,
- version 197a53bea1 commit,
- Side-by-side
- Inline
There are no changes yet
No changes between version 3 and version 3