]> source.dussan.org Git - nextcloud-server.git/commitdiff
[Sharing] Properly check if a group already has access
authorRoeland Jago Douma <rullzer@owncloud.com>
Fri, 4 Dec 2015 11:10:08 +0000 (12:10 +0100)
committerRoeland Jago Douma <rullzer@owncloud.com>
Fri, 4 Dec 2015 11:22:21 +0000 (12:22 +0100)
The old code check was to liberal resulting in wrong matches if a user
with the same name as the group already had access.

Fixes 20892

lib/private/share/share.php

index 70f9a6e8920fdd42e773133b4c86880eccc89a29..8899df25636b716e532505a7cb5a2a594663aa07 100644 (file)
@@ -745,10 +745,8 @@ class Share extends Constants {
                        // The check for each user in the group is done inside the put() function
                        if ($checkExists = self::getItems($itemType, $itemSource, self::SHARE_TYPE_GROUP, $shareWith,
                                null, self::FORMAT_NONE, null, 1, true, true)) {
-                               // Only allow the same share to occur again if it is the same
-                               // owner and is not a group share, this use case is for increasing
-                               // permissions for a specific user
-                               if ($checkExists['uid_owner'] != $uidOwner || $checkExists['share_type'] == $shareType) {
+
+                               if ($checkExists['share_with'] === $shareWith && $checkExists['share_type'] === \OCP\Share::SHARE_TYPE_GROUP) {
                                        $message = 'Sharing %s failed, because this item is already shared with %s';
                                        $message_t = $l->t('Sharing %s failed, because this item is already shared with %s', array($itemSourceName, $shareWith));
                                        \OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OCP\Util::DEBUG);