]> source.dussan.org Git - nextcloud-server.git/commitdiff
When a user is removed we should remove the right shares
authorRoeland Jago Douma <rullzer@owncloud.com>
Fri, 5 Feb 2016 09:01:59 +0000 (10:01 +0100)
committerRoeland Jago Douma <rullzer@owncloud.com>
Fri, 5 Feb 2016 09:05:22 +0000 (10:05 +0100)
* This means all the shares directly shared with them
* Or all group shares having a special share with them

This patch fixes the operator precedece (AND before OR).
So before this patch:

(share_with = <deleted user> AND share_type = 0) OR share_type=2

So it deleted all user specific shares

Now:
share_with = <deleted user> AND (share_type = 0 OR (share_type=2)

lib/private/share/hooks.php

index 1fa233916d1b2e45c312caafba2985cc6aeff56a..c939164e39ef2d16694c83898ea6f4a93f9f7def 100644 (file)
@@ -38,7 +38,7 @@ class Hooks extends \OC\Share\Constants {
        public static function post_deleteUser($arguments) {
                // Delete any items shared with the deleted user
                $query = \OC_DB::prepare('DELETE FROM `*PREFIX*share`'
-                       .' WHERE `share_with` = ? AND `share_type` = ? OR `share_type` = ?');
+                       .' WHERE `share_with` = ? AND (`share_type` = ? OR `share_type` = ?)');
                $query->execute(array($arguments['uid'], self::SHARE_TYPE_USER, self::$shareTypeGroupUserUnique));
                // Delete any items the deleted user shared
                $query = \OC_DB::prepare('SELECT `id` FROM `*PREFIX*share` WHERE `uid_owner` = ?');