Not everyone at once people!
I manages to find that the edit global action represents the permissions as SpacePermissions with null
targets.
private static final SpacePermission ANONYMOUS_CAN_USE_PERM = SpacePermission.createAnonymousSpacePermission(
"USECONFLUENCE",
(Space) null);
So I manages to update it by saving the space permission using
spacePermissionManager.savePermission(ANONYMOUS_CAN_USE_PERM);
This method is deprecated and refer to an alternative, but that one is in an internal package and I had troubles using that. Seems that I’m not alone in this regard: How to use SpacePermissionContext