owncloud / data_exporter

Export/Import for ownCloud user data
GNU General Public License v2.0
7 stars 5 forks source link

occ instance:import:user overwrites e.g. Photos with Skeleton files during import #234

Closed jnweiger closed 1 year ago

jnweiger commented 1 year ago

Seen with data_exporter-0.2.2

grafik

Expected behaviour:

dpapac commented 1 year ago

@jvillafanez needs more investigating to be done, if this behavior is to be expected

phil-davis commented 1 year ago

When the Importer sees that the user does not exist, it creates the user - good. But it does not make the user do a first login. The files, trashbin and share importer code is then run - good. Then when the user logs in the first time, there will be code that copies the skeleton files into place for the user. In this case, that is a problem. Maybe there is some "easy" way in `lib/Importer/MetadataImporter/UserImporter/import() to set whatever flag that indicates that the user has already had the "first login file system setup" done. Because in this case the import command is doing the file system setup. That would help avoid the skeleton being "restored/copied" over the top of the folder-file structure that has already been imported.

phil-davis commented 1 year ago

PR #236 fixes this for me. It seems to be as easy as just setting the last-login-timestamp so that later code does not end up forcing skeleton files into the user's fie system.

jvillafanez commented 1 year ago

As solution I guess it's ok, but I'm not sure if we should update the login timestamp when the user hasn't logged in.

Alternatively, we could adjust the conditions to copy the skeletons files. For example, if the last login timestamp is 0 and the user folder isn't already created, we could trigger the copy of the skeleton folder. However, it seems this isn't easy to check:

Unless someone has a better idea, I think we can go with https://github.com/owncloud/data_exporter/pull/236 , but we'll have to document that the user will be logged in the new server when the import finishes.

phil-davis commented 1 year ago

Unless someone has a better idea, I think we can go with #236

We need to signal to core that the user file system is "already set up". I think that the only way core currently knows that is if the last login timestamp has been set. So, without changing core, I don't see how else to do it. And we want the code to work with older oC core releases.

In real life the imported user is probably about to have their password (re)set and login anyway within the next days. So I don't think it really matters that the last login timestamp is being set to the time of the import.

phil-davis commented 1 year ago

but we'll have to document that the user will be logged in the new server when the import finishes.

See doc PR https://github.com/owncloud/docs-server/pull/1052