Errors after clearing the username-ldap user mapping

While investigating other issue, I pressed the “Clear Username-LDAP User Mapping” (in Admin->LDAP/AD integration->Expert )two days ago, like I’ve done sometimes in the past.

But this time the “LDAP user and group backend” was disabled in the process. When I reenabled it, ~10% of my users where moved from the usual id -their email- to a new one -email_NNNN-. This has created some problems, mainly their files were gone. But after modifying in our BBDD the entries in the owncloud_name in oc_ldap_user_mapping at least the user files reappeared in their folders.

Now our main remaining problem is that shared folders and files that where shared with any of this users are not accessible by them. Newly shared ones work ok. I’ve checked the oc_share table and everything is ok there. It looks like nextcloud can see the share, but it’s not able to make a connection with the id of the user sharing the file and the actual nextcloud user.

Any ideas?

Restore from backup?

I’ve thought about it, but at this moment a full restore may be even worse (now most of the affected users’ clients have already re-uploaded most of their files). Is there any way to know what specific parts of the DB should be restored?

Is there some internal documentation with DDBB details?