Migrate local user authentication to LDAP

Hi,

I'm running Owncloud with ~330 users on a single machine (for now). I'm using LDAP authentication (with an AD), but there are ~80 users in my local database and I want to migrate their data and shares to their LDAP user accounts.

I do this by using the occ command transfer-ownership to transfer user data and shares from the old user to the ldap user. This puts all user data and shares in a folder ("transferedfrom...") in the ldap users root. But i want that data not in an extra directory, it should be in the root of the ldap user.

I moved the data directly on my server and used the files:scan command to scan for new files and to update the file cache. But I lose the shares. I don't want to reset user passwords or let them do the work, so I'm looking for a way to transfer the shares as well.

Another way i found is updating the oc_ldap_user_mapping like so:

update oc_ldap_user_mapping set owncloud_name="" where ldap_dn="";

But I'm not sure about unwanted side effects.This seems a bit invasive when all I need to do is transfering data and shares inside a users directory (as admin and not the user).

So I thought I could ask here, maybe there is a better, more elegant way to achieve all of this.

Thanks a lot in advance for any answers!

Server configuration
Operating system: Ubuntu 14.04.5 LTS
Web server: apache2 (2.4.7)
Database: mysql (5.6)
PHP version: 5.5.9
ownCloud version: 9.1.4
Updated from an older ownCloud or fresh install: updated several times, started at 8.1 or 8.2