Allow removing federated shares of locally reshared files

* 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>
This commit is contained in:
Roeland Jago Douma 2019-10-03 15:21:04 +02:00 committed by Backportbot
parent ba25fe84e0
commit 0c5978447f
1 changed files with 5 additions and 0 deletions

View File

@ -563,6 +563,11 @@ class FederatedShareProvider implements IShareProvider {
* @throws \OC\HintException * @throws \OC\HintException
*/ */
protected function revokeShare($share, $isOwner) { 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 // also send a unShare request to the initiator, if this is a different user than the owner
if ($share->getShareOwner() !== $share->getSharedBy()) { if ($share->getShareOwner() !== $share->getSharedBy()) {
if ($isOwner) { if ($isOwner) {