From 0817024e6f817a04c1258dba971f412550f6a058 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 1 Oct 2015 15:37:26 +0200 Subject: Mark shares as dirty when changing permissions --- lib/private/share/share.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/private/share/share.php b/lib/private/share/share.php index 97c36a03c86..7f9b899bf63 100644 --- a/lib/private/share/share.php +++ b/lib/private/share/share.php @@ -1099,6 +1099,7 @@ class Share extends Constants { 'uidOwner' => \OC_User::getUser(), 'permissions' => $permissions, 'path' => $item['path'], + 'share' => $item )); } // Check if permissions were removed @@ -1109,16 +1110,18 @@ class Share extends Constants { Helper::delete($item['id'], true, null, null, true); } else { $ids = array(); + $items = []; $parents = array($item['id']); while (!empty($parents)) { $parents = "'".implode("','", $parents)."'"; - $query = \OC_DB::prepare('SELECT `id`, `permissions` FROM `*PREFIX*share`' + $query = \OC_DB::prepare('SELECT `id`, `permissions`, `item_type` FROM `*PREFIX*share`' .' WHERE `parent` IN ('.$parents.')'); $result = $query->execute(); // Reset parents array, only go through loop again if // items are found that need permissions removed $parents = array(); while ($item = $result->fetchRow()) { + $items[] = $item; // Check if permissions need to be removed if ($item['permissions'] & ~$permissions) { // Add to list of items that need permissions removed @@ -1140,8 +1143,13 @@ class Share extends Constants { .' WHERE `id` IN ('.$ids.')'); $query->execute(array($permissions)); } + + foreach ($items as $item) { + \OC_Hook::emit('OCP\Share', 'post_update_permissions', ['share' => $item]); + } } } + return true; } $message = 'Setting permissions for %s failed, because the item was not found'; -- cgit v1.2.3