How to recover space permissions

Description

Have you ever had a space that cannot be accessed? Even by an administrator. You know it exists, but no one has permission to see it. For instance, no one can delete it, yet you cannot create a space with the same key as Confluence says it already exists. Some symptoms of this issue are:

Not permitted to delete space with key: ...

A space already exists with key ...

We see this problem on Cloud randomly (but often) in our automated testing. We have not seen this on Server.

This post describes how to fix this problem.

From UI

Easy enough via the UI: Administration → Space Permissions → look for space and find a Recover Permissions link.

Using CLI

-a renderRequest --request /admin/permissions/grantspacepermissions.action --requestParameters key=XXX --file ""

Using GINT

Requires GINT 2.8.0 or higher

...
[action: 'renderRequest', ext: 'AvoidPermissionProblem',
    space: space,
    parameters: [
        request: '/admin/permissions/grantspacepermissions.action',
        requestParameters: 'key=' + space,
        file: '', // don't need output
    ],
],
gint.getRemoveSpaceTestcase(depends: 'renderRequestAvoidPermissionProblem'), 
...