How to fix broken permissions on an imported space via SQL when permissions page inaccessible
Asked by Michael Corvin:

1. I exported a space from our current Confluence Cloud site to import into this Sever site (v 6.12.2). The exported site had the same key ("LUCY") as an existing space on the server site so I had to change it (to "LUCYS")

2. I edited the "entities.xml" file to replace the oldkey with the newkey per the instructions here: <https://confluence.atlassian.com/confkb/how-to-copy-or-rename-a-space-in-confluence-169578.html>

3. I imported the space as a user with server admin privileges (in group confluence-administrators). However, at the time of import that user was not in "site-admins", the cloud admin group with global access permissions, and that group did not exist yet in the Crowd directory used to authenticate that user). All the user IDs in the server site are, of course, different.

4. I re-indexed the server site.

5. Search found the new space and contents within it BUT the importing, server admin user could not view any of the space contents (pages or attachments). \*The permissions page for the imported space also cannot be viewed so permissions cannot be recovered using the Confluence admin pages.\*

6. I created "site-admins" group in Crowd and add the importing server admin user to that group. I made sure to sync the directory in Confluence and verified that the user has that group in Confluence. I flushed all caches, rebuilt the ancestor table and re-indexed the site again.

7. The user in site-admins group still cannot see any content in the space and cannot view the space permissions page either.

Since there seems to be no way to fix this from within Confluence I assume it must be fixed by SQL queries to the Confluence database - ? What are the queries I should use and what tables and fields need to be updated, and how, to recover permissions for an admin on the server site so I can then set permissions for the other users?

Thanks!


Answers:
author: Aafiya Saifi
body: Helo


author: Ha Tran
body: I'm running into the same issue [@Michael Corvin](/t5/user/viewprofilepage/user-id/695608)and I'm with Confluence Data Center v7.19.6.

I'm able to query the Space that I imported from database side but can't access from Confluence even though the Space searchable under Confluence Admin / Space Permission

Any suggestion to solve this issue?

Thanks in advance

Hannah

comments: author: Michael Corvin
body: sorry, no suggestions.

We're punting on Confluence and Atlassian in general. Good luck with the huge investment in Data Center. If it gains all the joys and lost functionality of the 'new editing experience' that Cloud has you're going to have your user base screaming bleeping murder...


author: Ha Tran
body: I was able to fix the issue by run this script on database

update public.spacepermissions set permgroupname = '*groupname' (valid group name)* WHERE spaceid = spaceid (retrieve from Space table) and permtype = 'VIEWSPACE';

But I want to avoid touching database


author: Kirstin Seidel-Gebert
body: Hi Michael,

what if you deleted the imported space and reimported it under the new permission settings?

Cheers,

Kirstin

comments: author: Michael Corvin
body: Thanks for your suggestion, but since I cannot access the space at all I can't get to the delete space function... I \*should\* be able to as a confluence-administrators user, but the import of the cloud space to our server seems to have broken all permissions. I could delete the space from the database, which is how I probably will have to fix this.


Tags: confluence-server

server