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

Update owner of subdir on move into/out of share #31728

Merged
merged 8 commits into from
Jul 26, 2022

Conversation

PVince81
Copy link
Member

@PVince81 PVince81 commented Mar 28, 2022

When moving a directory into or out of a received share, make sure to
also update the share owner column for shares that exist insie the
directory.

Fixes #30791

All the three scenarios listed there are fixed.

  • check for possible side effects
  • check for possible performance problems for regular rename cases
  • test also with reshare scenarios
  • add unit tests and/or integration tests

@artonge artonge force-pushed the bugfix/30791/update-subshare-owner-on-move branch from dd5f8ce to ab7771b Compare March 31, 2022 09:38
Copy link
Contributor

@artonge artonge left a comment

Choose a reason for hiding this comment

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

The "moving out of share" scenario is not taken into account as we exit early here: Updater.php:88

Handled in 7ae7ce6

@artonge
Copy link
Contributor

artonge commented Mar 31, 2022

Will look into testing this afternoon.

Done.

Test checks for the following for both a file and a folder:

  • uid_owner change when moving share in another share
    uid_owner become the uid_owner of the destination share
  • permissions change when moving share on another share
    permissions are limited by the permissions of the destination share
    → if moved_share has PERMISSION_ALL, and destination_share has PERMISSION_READ, after the move, moved_share will only have PERMISSION_READ.
  • uid_owner change when moving share out from another share
    uid_owner become the current user
  • permissions stays the same when moving share out from another share

continue;
}

if ($dstMount instanceof \OCA\Files_Sharing\SharedMount) {
if (!($dstMount->getShare()->getPermissions() & Constants::PERMISSION_SHARE)) {
Copy link
Contributor

@artonge artonge Mar 31, 2022

Choose a reason for hiding this comment

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

So, if the destination is a share and does not have the SHARE permission, we delete the current share?

Not sure about the rational.

@artonge artonge force-pushed the bugfix/30791/update-subshare-owner-on-move branch 4 times, most recently from 0975680 to 7f43c94 Compare March 31, 2022 15:39
@PVince81
Copy link
Member Author

PVince81 commented Apr 1, 2022

@artonge I only realized late that you were also working on this. In parallel I wrote two integration tests.
Great to see that you fixed the "move out" scenario where my test failed 😄

@artonge artonge force-pushed the bugfix/30791/update-subshare-owner-on-move branch from 71406c6 to 8a1d8f5 Compare April 5, 2022 15:01
@artonge
Copy link
Contributor

artonge commented Apr 5, 2022

⚠️ New bug ⚠️ (will be fixed in a follow up)

With S3 bucket as primary storage, when moving a share out from a share, the file_id changes, but the item_source and file_target are not updated in oc_share.

Issue: #31870

The failing test has been disabled, and will be re-enabled when the new issue is fixed

@artonge

This comment was marked as resolved.

@blizzz blizzz mentioned this pull request Apr 7, 2022
@artonge
Copy link
Contributor

artonge commented Jun 27, 2022

videoverification tests seem broken?

It's about the implementation of IShareProvider::getSharesInFolder in Talk. Not sure how to handle this case, should we fix it in Talk first, or merge this one and fix in Talk later?

@blizzz
Copy link
Member

blizzz commented Jul 5, 2022

videoverification tests seem broken?

It's about the implementation of IShareProvider::getSharesInFolder in Talk. Not sure how to handle this case, should we fix it in Talk first, or merge this one and fix in Talk later?

Ah, so we are having a breaking change here. Then it also would need to be documented in #32117

Ideally it would work without breaking the APi (via deprecations), but probably that's not feasible?

artonge added a commit to nextcloud/spreed that referenced this pull request Jul 26, 2022
A new `$shallow` argument was introduced to `IShareProvider::getSharesInFolder` in NC25 by nextcloud/server#31728.

This PR adds this new argument and the necessary changes to make it work based on this example https://github.com/nextcloud/server/pull/31728/files#diff-dee1351696d7eae959761edf66c8e5a9052e28be73319733d857a9ab2d9fc967=

Signed-off-by: Louis Chemineau <louis@chmn.me>
artonge added a commit to nextcloud/spreed that referenced this pull request Jul 26, 2022
A new `$shallow` argument was introduced to `IShareProvider::getSharesInFolder` in NC25 by nextcloud/server#31728.

This PR adds this new argument and the necessary changes to make it work based on this example https://github.com/nextcloud/server/pull/31728/files#diff-dee1351696d7eae959761edf66c8e5a9052e28be73319733d857a9ab2d9fc967=

Signed-off-by: Louis Chemineau <louis@chmn.me>
@artonge
Copy link
Contributor

artonge commented Jul 26, 2022

/rebase

artonge and others added 8 commits July 26, 2022 12:17
Signed-off-by: Louis Chemineau <louis@chmn.me>
When moving a directory into or out of a received share, make sure to
also update the share owner column for shares that exist insie the
directory.

Signed-off-by: Vincent Petry <vincent@nextcloud.com>
Signed-off-by: Louis Chemineau <louis@chmn.me>
Signed-off-by: Louis Chemineau <louis@chmn.me>
Added tests to verify share owner change when moving the parent of a
subshare in and out of a received share.

Signed-off-by: Vincent Petry <vincent@nextcloud.com>
Signed-off-by: Louis Chemineau <louis@chmn.me>
Signed-off-by: Louis Chemineau <louis@chmn.me>
Signed-off-by: Louis Chemineau <louis@chmn.me>
@nextcloud-command nextcloud-command force-pushed the bugfix/30791/update-subshare-owner-on-move branch from 55fa748 to f525067 Compare July 26, 2022 12:17
@artonge
Copy link
Contributor

artonge commented Jul 26, 2022

CI failure unrelated (videoverification is fixed by nextcloud/spreed#7648)

@artonge artonge merged commit a32de93 into master Jul 26, 2022
@artonge artonge deleted the bugfix/30791/update-subshare-owner-on-move branch July 26, 2022 15:11
@CarlSchwan
Copy link
Member

I noticed that this breaks circle due to the API break in the interface :(

artonge added a commit to nextcloud/circles that referenced this pull request Jul 27, 2022
A new `$shallow` argument was introduced to `IShareProvider::getSharesInFolder` in NC25 by nextcloud/server#31728.

This PR adds this new argument and the necessary changes to make it work based on this example https://github.com/nextcloud/server/pull/31728/files#diff-dee1351696d7eae959761edf66c8e5a9052e28be73319733d857a9ab2d9fc967=

Signed-off-by: Louis Chemineau <louis@chmn.me>
artonge added a commit to nextcloud/circles that referenced this pull request Jul 27, 2022
A new `$shallow` argument was introduced to `IShareProvider::getSharesInFolder` in NC25 by nextcloud/server#31728.

This PR adds this new argument and the necessary changes to make it work based on this example https://github.com/nextcloud/server/pull/31728/files#diff-dee1351696d7eae959761edf66c8e5a9052e28be73319733d857a9ab2d9fc967=

Signed-off-by: Louis Chemineau <louis@chmn.me>
artonge added a commit to nextcloud/circles that referenced this pull request Jul 27, 2022
A new `$shallow` argument was introduced to `IShareProvider::getSharesInFolder` in NC25 by nextcloud/server#31728.

This PR adds this new argument and the necessary changes to make it work based on this example https://github.com/nextcloud/server/pull/31728/files#diff-dee1351696d7eae959761edf66c8e5a9052e28be73319733d857a9ab2d9fc967=

Signed-off-by: Louis Chemineau <louis@chmn.me>
artonge added a commit to nextcloud/circles that referenced this pull request Jul 27, 2022
A new `$shallow` argument was introduced to `IShareProvider::getSharesInFolder` in NC25 by nextcloud/server#31728.

This PR adds this new argument and the necessary changes to make it work based on this example https://github.com/nextcloud/server/pull/31728/files#diff-dee1351696d7eae959761edf66c8e5a9052e28be73319733d857a9ab2d9fc967=

Signed-off-by: Louis Chemineau <louis@chmn.me>
artonge added a commit to nextcloud/circles that referenced this pull request Jul 27, 2022
A new `$shallow` argument was introduced to `IShareProvider::getSharesInFolder` in NC25 by nextcloud/server#31728.

This PR adds this new argument and the necessary changes to make it work based on this example https://github.com/nextcloud/server/pull/31728/files#diff-dee1351696d7eae959761edf66c8e5a9052e28be73319733d857a9ab2d9fc967=

Signed-off-by: Louis Chemineau <louis@chmn.me>
@skjnldsv skjnldsv mentioned this pull request Aug 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Moving share in/out of another one doesn't update uid_owner in some cases
8 participants