Merge pull request #3980 from owncloud/try-permissions-hook-again

Add update permissions hook to sharing
This commit is contained in:
Jörn Friedrich Dreyer 2013-07-09 05:40:16 -07:00
commit cc0965b9bc
1 changed files with 11 additions and 9 deletions

View File

@ -657,15 +657,17 @@ class Share {
} }
$query = \OC_DB::prepare('UPDATE `*PREFIX*share` SET `permissions` = ? WHERE `id` = ?'); $query = \OC_DB::prepare('UPDATE `*PREFIX*share` SET `permissions` = ? WHERE `id` = ?');
$query->execute(array($permissions, $item['id'])); $query->execute(array($permissions, $item['id']));
\OC_Hook::emit('OCP\Share', 'post_update_permissions', array( if ($itemType === 'file' || $itemType === 'folder') {
'itemType' => $itemType, \OC_Hook::emit('OCP\Share', 'post_update_permissions', array(
'itemSource' => $itemSource, 'itemType' => $itemType,
'itemTarget' => $itemTarget, 'itemSource' => $itemSource,
'shareType' => $shareType, 'shareType' => $shareType,
'shareWith' => $shareWith, 'shareWith' => $shareWith,
'uidOwner' => \OC_User::getUser(), 'uidOwner' => \OC_User::getUser(),
'permissions' => $permissions, 'permissions' => $permissions,
)); 'path' => $item['path'],
));
}
// Check if permissions were removed // Check if permissions were removed
if ($item['permissions'] & ~$permissions) { if ($item['permissions'] & ~$permissions) {
// If share permission is removed all reshares must be deleted // If share permission is removed all reshares must be deleted