summaryrefslogtreecommitdiffstats
path: root/apps/federatedfilesharing/lib/FederatedShareProvider.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/federatedfilesharing/lib/FederatedShareProvider.php')
-rw-r--r--apps/federatedfilesharing/lib/FederatedShareProvider.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/apps/federatedfilesharing/lib/FederatedShareProvider.php b/apps/federatedfilesharing/lib/FederatedShareProvider.php
index 762b015d280..91398f4af35 100644
--- a/apps/federatedfilesharing/lib/FederatedShareProvider.php
+++ b/apps/federatedfilesharing/lib/FederatedShareProvider.php
@@ -313,10 +313,34 @@ class FederatedShareProvider implements IShareProvider {
->set('uid_initiator', $qb->createNamedParameter($share->getSharedBy()))
->execute();
+ // send the updated permission to the owner/initiator, if they are not the same
+ if ($share->getShareOwner() !== $share->getSharedBy()) {
+ $this->sendPermissionUpdate($share);
+ }
+
return $share;
}
/**
+ * send the updated permission to the owner/initiator, if they are not the same
+ *
+ * @param IShare $share
+ * @throws ShareNotFound
+ * @throws \OC\HintException
+ */
+ protected function sendPermissionUpdate(IShare $share) {
+ $remoteId = $this->getRemoteId($share);
+ // if the local user is the owner we send the permission change to the initiator
+ if ($this->userManager->userExists($share->getShareOwner())) {
+ list(, $remote) = $this->addressHandler->splitUserRemote($share->getSharedBy());
+ } else { // ... if not we send the permission change to the owner
+ list(, $remote) = $this->addressHandler->splitUserRemote($share->getShareOwner());
+ }
+ $this->notifications->sendPermissionChange($remote, $remoteId, $share->getToken(), $share->getPermissions());
+ }
+
+
+ /**
* update successful reShare with the correct token
*
* @param int $shareId