]> source.dussan.org Git - nextcloud-server.git/commitdiff
Allow removing federated shares of locally reshared files 17387/head
authorRoeland Jago Douma <roeland@famdouma.nl>
Thu, 3 Oct 2019 13:21:04 +0000 (15:21 +0200)
committerRoeland Jago Douma <roeland@famdouma.nl>
Thu, 3 Oct 2019 13:21:04 +0000 (15:21 +0200)
* UserA shares a folder to UserB
* UserB does a federated share to userC@serverC
* UserB now tries to revoke the federated share

Before we always tried to notify the remote cloud. The case that the
file was reshared locally was not considered. This patch makes sure not
to try to notify a federated server if both users are local users.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
apps/federatedfilesharing/lib/FederatedShareProvider.php

index f0ec9e3cb6865fcbdace3ab47726ef216ada7d60..67089cba9d37cdd07af6baf392dc2c0821d03613 100644 (file)
@@ -563,6 +563,11 @@ class FederatedShareProvider implements IShareProvider {
         * @throws \OC\HintException
         */
        protected function revokeShare($share, $isOwner) {
+               if ($this->userManager->userExists($share->getShareOwner() && $this->userManager->userExists($share->getSharedBy()))) {
+                       // If both the owner and the initiator of the share are local users we don't have to notify anybody else
+                       return;
+               }
+
                // also send a unShare request to the initiator, if this is a different user than the owner
                if ($share->getShareOwner() !== $share->getSharedBy()) {
                        if ($isOwner) {