From 6144ced7a09356a0aaa70cdc359613d3abf8d28e Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Wed, 13 Apr 2016 15:00:12 +0200 Subject: Move post_removeFromGroup to shareManager The last sharing hook to be moved over. * Added unit tests * Removed old tests that relied on old behaviour * Removed old hooks.php --- lib/private/share/hooks.php | 46 --------------------------------------------- 1 file changed, 46 deletions(-) delete mode 100644 lib/private/share/hooks.php (limited to 'lib/private/share') diff --git a/lib/private/share/hooks.php b/lib/private/share/hooks.php deleted file mode 100644 index 5faf81c5e9b..00000000000 --- a/lib/private/share/hooks.php +++ /dev/null @@ -1,46 +0,0 @@ - - * @author Morris Jobke - * @author Robin McCorkell - * @author Roeland Jago Douma - * - * @copyright Copyright (c) 2016, ownCloud, Inc. - * @license AGPL-3.0 - * - * This code is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License, version 3, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License, version 3, - * along with this program. If not, see - * - */ - -namespace OC\Share; - -class Hooks extends \OC\Share\Constants { - /** - * Function that is called after a user is removed from a group. Shares are cleaned up. - * @param array $arguments - */ - public static function post_removeFromGroup($arguments) { - $sql = 'SELECT `id`, `share_type` FROM `*PREFIX*share`' - .' WHERE (`share_type` = ? AND `share_with` = ?) OR (`share_type` = ? AND `share_with` = ?)'; - $result = \OC_DB::executeAudited($sql, array(self::SHARE_TYPE_GROUP, $arguments['gid'], - self::$shareTypeGroupUserUnique, $arguments['uid'])); - while ($item = $result->fetchRow()) { - if ($item['share_type'] == self::SHARE_TYPE_GROUP) { - // Delete all reshares by this user of the group share - Helper::delete($item['id'], true, $arguments['uid']); - } else { - Helper::delete($item['id']); - } - } - } -} -- cgit v1.2.3