[Pkg-owncloud-commits] [owncloud] 166/258: 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

David Prévot taffit at moszumanska.debian.org
Sat Oct 11 17:22:32 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository owncloud.

commit 3b1715c3fc718a66a6ab41b762b6550748669e27
Author: Bjoern Schiessle <schiessle at owncloud.com>
Date:   Fri Sep 26 13:01:54 2014 +0200

    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
---
 lib/private/share/share.php | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/lib/private/share/share.php b/lib/private/share/share.php
index aa64e3f..3bae382 100644
--- a/lib/private/share/share.php
+++ b/lib/private/share/share.php
@@ -1291,7 +1291,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
@@ -1330,6 +1330,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) {
@@ -1653,6 +1659,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,

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list