There may come a day where you need to script the migration of permissions from one Confluence Space to another.
The permissions of a Confluence Space can be retrieved and treated as collection of objects. This allows us to easily pass them on to a source page as a new set of permissions.
We’re using the Soap Service to affect change in the permissions of a Space. After using the ComponentLocator to declare the SpaceSoapService, we retrieve the source Space as an object. We do the same for the destination source.
The permissions of the source Space are then extracted. This is not a single object, but rather a collection of objects.
We iterate through each of the permission objects. Each object is a collection of attributes. We need to determine if the permissions object relates to a single user, or a group. Every type of permission gets it’s own object.
Permissions objects associated with a group look like so:
The first attribute is the permission type. The second is the permission ID. The third element is the group with which this permission is associated, and this is where the format of the permissions object differs