diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2014-09-26 13:01:54 +0200 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2014-09-26 13:01:54 +0200 |
commit | d242e518f93c5588462486920fc22ee8db1802f3 (patch) | |
tree | ea37e9397b10013e715fe3f8b37869bc8e7b630c | |
parent | 52b6469b0c2a21ce6e77f8c56dae464eac99781e (diff) | |
download | nextcloud-server-d242e518f93c5588462486920fc22ee8db1802f3.tar.gz nextcloud-server-d242e518f93c5588462486920fc22ee8db1802f3.zip |
for group shares only the parent has the up-to-date permission. Make sure that we always use this permission, except if the user permission is '0' because in this case the user unshared the group share from self
-rw-r--r-- | lib/private/share/share.php | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/private/share/share.php b/lib/private/share/share.php index 10b7acd9fed..e0e9fcfd05f 100644 --- a/lib/private/share/share.php +++ b/lib/private/share/share.php @@ -1295,7 +1295,7 @@ class Share extends \OC\Share\Constants { } } - if ($shareType == self::$shareTypeUserAndGroups) { + if ($shareType == self::$shareTypeUserAndGroups && $limit === 1) { // Make sure the unique user target is returned if it exists, // unique targets should follow the group share in the database // If the limit is not 1, the filtering can be done later @@ -1334,6 +1334,12 @@ class Share extends \OC\Share\Constants { $row['share_type'] = self::SHARE_TYPE_GROUP; $row['unique_name'] = true; // remember that we use a unique name for this user $row['share_with'] = $items[$row['parent']]['share_with']; + // if the group share was unshared from the user we keep the permission, otherwise + // we take the permission from the parent because this is always the up-to-date + // permission for the group share + if ($row['permissions'] > 0) { + $row['permissions'] = $items[$row['parent']]['permissions']; + } // Remove the parent group share unset($items[$row['parent']]); if ($row['permissions'] == 0) { @@ -1657,6 +1663,11 @@ class Share extends \OC\Share\Constants { $fileTarget = $sourceExists['file_target']; $itemTarget = $sourceExists['item_target']; + // for group shares we don't need a additional entry if the target is the same + //if($isGroupShare && $groupItemTarget === $itemTarget) { + // continue; + //} + } elseif(!$sourceExists && !$isGroupShare) { $itemTarget = Helper::generateTarget($itemType, $itemSource, self::SHARE_TYPE_USER, $user, |