diff options
author | Bjoern Schiessle <bjoern@schiessle.org> | 2018-06-29 18:02:12 +0200 |
---|---|---|
committer | Bjoern Schiessle <bjoern@schiessle.org> | 2018-07-11 10:11:47 +0200 |
commit | 1d5a9c3f979b23bac98243ba2245a21bdff722c8 (patch) | |
tree | 4f28b0c42618271c0955117f3c96770cdf47817d /apps | |
parent | 7d2add622e1948f85e0c2abe4fc5a71123b7bcde (diff) | |
download | nextcloud-server-1d5a9c3f979b23bac98243ba2245a21bdff722c8.tar.gz nextcloud-server-1d5a9c3f979b23bac98243ba2245a21bdff722c8.zip |
handle unshare request from owner
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/federatedfilesharing/lib/ocm/CloudFederationProviderFiles.php | 43 |
1 files changed, 25 insertions, 18 deletions
diff --git a/apps/federatedfilesharing/lib/ocm/CloudFederationProviderFiles.php b/apps/federatedfilesharing/lib/ocm/CloudFederationProviderFiles.php index 1f46c6b677d..1d922ce60ba 100644 --- a/apps/federatedfilesharing/lib/ocm/CloudFederationProviderFiles.php +++ b/apps/federatedfilesharing/lib/ocm/CloudFederationProviderFiles.php @@ -578,25 +578,32 @@ class CloudFederationProviderFiles implements ICloudFederationProvider { $qb->execute(); - if ($share['accepted']) { - $path = trim($mountpoint, '/'); - } else { - $path = trim($share['name'], '/'); - } + // delete all child in case of a group share + $qb = $this->connection->getQueryBuilder(); + $qb->delete('share_external') + ->where($qb->expr()->eq('parent', $qb->createNamedParameter((int)$share['id']))); + $qb->execute(); - $notification = $this->notificationManager->createNotification(); - $notification->setApp('files_sharing') - ->setUser($share['user']) - ->setObject('remote_share', (int)$share['id']); - $this->notificationManager->markProcessed($notification); - - $event = $this->activityManager->generateEvent(); - $event->setApp('files_sharing') - ->setType('remote_share') - ->setSubject(RemoteShares::SUBJECT_REMOTE_SHARE_UNSHARED, [$owner->getId(), $path]) - ->setAffectedUser($user) - ->setObject('remote_share', (int)$share['id'], $path); - \OC::$server->getActivityManager()->publish($event); + if ((int)$share['share_type'] === Share::SHARE_TYPE_USER) { + if ($share['accepted']) { + $path = trim($mountpoint, '/'); + } else { + $path = trim($share['name'], '/'); + } + $notification = $this->notificationManager->createNotification(); + $notification->setApp('files_sharing') + ->setUser($share['user']) + ->setObject('remote_share', (int)$share['id']); + $this->notificationManager->markProcessed($notification); + + $event = $this->activityManager->generateEvent(); + $event->setApp('files_sharing') + ->setType('remote_share') + ->setSubject(RemoteShares::SUBJECT_REMOTE_SHARE_UNSHARED, [$owner->getId(), $path]) + ->setAffectedUser($user) + ->setObject('remote_share', (int)$share['id'], $path); + \OC::$server->getActivityManager()->publish($event); + } } return []; |