Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix share transfer of single files and on the transfered node #22116

Merged
merged 1 commit into from
Sep 1, 2020

Conversation

juliusknorr
Copy link
Member

@juliusknorr juliusknorr commented Aug 5, 2020

Fixes #21625

This fixes an issue where shares on single file transfers or on the root folder that is being transfered could not me moved over.

There were two issues here with the current implementation:

  • When doing partial transfers with a path the shares to transfer were not filtered out so the transfer command attempted to migrate all shares to the new user
  • The UserMountCache and Share object still had the old node information in their caches, so the share ownership checks had unexpected input data in
    $userMounts = $userFolder->getById($share->getNode()->getId());
    $userMount = array_shift($userMounts);
    $mount = $userMount->getMountPoint();
    if (!$isFederatedShare && $share->getNode()->getOwner() && $share->getNode()->getOwner()->getUID() !== $share->getSharedBy()) {

Steps to reproduce:

  • Share a file f100.txt as admin with user1
  • Transfer the file to user2 occ files:transfer-ownership --path=f100.txt admin user2

@MorrisJobke MorrisJobke mentioned this pull request Aug 11, 2020
57 tasks
@juliusknorr juliusknorr force-pushed the bugfix/noid/transfer-ownership-share-root branch from 1eb8ddc to 2bbabfc Compare August 11, 2020 15:28
@rullzer rullzer force-pushed the bugfix/noid/transfer-ownership-share-root branch from 2bbabfc to e361e0c Compare August 11, 2020 18:35
@MorrisJobke
Copy link
Member

CI says "no".

This was referenced Aug 21, 2020
@juliusknorr juliusknorr force-pushed the bugfix/noid/transfer-ownership-share-root branch from d6974b3 to 25b9701 Compare August 31, 2020 11:29
Copy link
Member

@ChristophWurst ChristophWurst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:+

Signed-off-by: Julius Härtl <jus@bitgrid.net>
@juliusknorr juliusknorr force-pushed the bugfix/noid/transfer-ownership-share-root branch from e4f77ec to ac2999a Compare August 31, 2020 12:23
@juliusknorr
Copy link
Member Author

Ready for another review, since i needed to go a bit of a different way to check if a share is contained in the transferred directory. Tests seem to pass now (before the rebase).

I'd actually like to extend the integration tests with some cases for this, but I'm still unable to get them to run locally, so I'd postpone this for a later point.

Copy link
Member

@blizzz blizzz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐘

@rullzer rullzer merged commit d0a7f83 into master Sep 1, 2020
@rullzer rullzer deleted the bugfix/noid/transfer-ownership-share-root branch September 1, 2020 06:50
@danxuliu
Copy link
Member

danxuliu commented Sep 7, 2020

@danxuliu
Copy link
Member

danxuliu commented Sep 7, 2020

Actually it seems to be a problem with reshares in general.

Steps to reproduce:

  • user0 shares fileA with user1
  • user1 shares fileA with user2
  • occ files:transfer-ownership user1 user3

Expected result:

fileA is reshared from user3 to user2

Actual result:

fileA is still reshared from user1 to user2

@juliusknorr
Copy link
Member Author

juliusknorr commented Sep 7, 2020

Ah, the source path is of course not null if no path is provided. 🙈

@juliusknorr
Copy link
Member Author

backports:
stable18 #22802
stable19 #22804

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Transfering folder ownership breaks shares
7 participants