]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix OCS API to be able to remove group shares from self as recipient
authorRoeland Jago Douma <roeland@famdouma.nl>
Tue, 25 Oct 2016 08:18:42 +0000 (10:18 +0200)
committerRoeland Jago Douma <roeland@famdouma.nl>
Wed, 2 Nov 2016 07:49:58 +0000 (08:49 +0100)
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
apps/files_sharing/lib/Controller/ShareAPIController.php

index ad9ac6c0851c09660e977f5ddedbdce6118975fb..0d62ba48ed5e72eabeb2c85bcf1750ba0f533cd0 100644 (file)
@@ -245,11 +245,17 @@ class ShareAPIController extends OCSController {
                        throw new OCSNotFoundException($this->l->t('could not delete share'));
                }
 
-               if (!$this->canAccessShare($share, false)) {
+               if (!$this->canAccessShare($share)) {
                        throw new OCSNotFoundException($this->l->t('Could not delete share'));
                }
 
-               $this->shareManager->deleteShare($share);
+               if ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP &&
+                       $share->getShareOwner() !== $this->currentUser &&
+                       $share->getSharedBy() !== $this->currentUser) {
+                       $this->shareManager->deleteFromSelf($share, $this->currentUser);
+               } else {
+                       $this->shareManager->deleteShare($share);
+               }
 
                return new DataResponse();
        }