I am currently writing a space blueprint for Confluence. I already got so far that I am able to get a list of usernames from the "Create Space Dialog" and display those usernames in a table on the space homepage via a simple self written Java Context Provider.
I now also want to assign specific space permissions (other than the Confluence default ones) for those users on the fly, so that I don't have to set them manually after the space was created.
I tried to use the savePermission() method of the SpacePermissionManager class. However this requires me to create a Permission object before, for which I need a Space object.
It is not clear to me if this is even possible because I cannot retrieve a space which I am currently creating with the blueprint, right?
Are there any other methods to to this properly?
Here is my current code in the Java Context Provider
// Instead of "TEST" I need the space I am currently creating
Space space = this.spaceManager.getSpace("TEST");
// Hardcoded "user3" for testing purposes
SpacePermission defaultPermission = SpacePermission.createUserSpacePermission(SpacePermission.EDITBLOG_PERMISSION, space, "user3");
this.spacePermissionManager.savePermission(defaultPermission);
Any help would be greatly appreciated.
Cheers