summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@owncloud.com>2016-01-27 09:02:12 +0100
committerRoeland Jago Douma <rullzer@owncloud.com>2016-01-27 09:02:12 +0100
commita4900d721f466540987f2770b5cf66aa95164c85 (patch)
treed7e373cb9e73022f210e05d4f11fec32fc8aa309 /apps/files_sharing
parent1df31c802b51ce74282dfa83875cb50346b1d698 (diff)
downloadnextcloud-server-a4900d721f466540987f2770b5cf66aa95164c85.tar.gz
nextcloud-server-a4900d721f466540987f2770b5cf66aa95164c85.zip
[Share 2.0] Properly handle user deleted group shares
If a user deletes a group share we create a special share entry. To the API this is just a normal group share for that user with permissions 0. But we should not return this.
Diffstat (limited to 'apps/files_sharing')
-rw-r--r--apps/files_sharing/api/share20ocs.php9
1 files changed, 8 insertions, 1 deletions
diff --git a/apps/files_sharing/api/share20ocs.php b/apps/files_sharing/api/share20ocs.php
index c2ff94db790..7ec15f5b252 100644
--- a/apps/files_sharing/api/share20ocs.php
+++ b/apps/files_sharing/api/share20ocs.php
@@ -335,7 +335,9 @@ class Share20OCS {
$formatted = [];
foreach ($shares as $share) {
- $formatted[] = $this->formatShare($share);
+ if ($this->canAccessShare($share)) {
+ $formatted[] = $this->formatShare($share);
+ }
}
return new \OC_OCS_Result($formatted);
@@ -430,6 +432,11 @@ class Share20OCS {
* @return bool
*/
protected function canAccessShare(IShare $share) {
+ // A file with permissions 0 can't be accessed by us. So Don't show it
+ if ($share->getPermissions() === 0) {
+ return false;
+ }
+
// Owner of the file and the sharer of the file can always get share
if ($share->getShareOwner() === $this->currentUser ||
$share->getSharedBy() === $this->currentUser