diff options
author | Joas Schilling <coding@schilljs.com> | 2020-07-27 12:12:11 +0200 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2020-07-30 07:51:14 +0000 |
commit | e7d2dde4637d625aa156d297d6da30b1e5b11996 (patch) | |
tree | d514fc4a6e9b5e53a4cbda214104faf9a3d30165 /lib/private/Share20 | |
parent | 403040255f36e97be523dbaff50627c76dee1a6d (diff) | |
download | nextcloud-server-e7d2dde4637d625aa156d297d6da30b1e5b11996.tar.gz nextcloud-server-e7d2dde4637d625aa156d297d6da30b1e5b11996.zip |
Correctly remove usergroup shares on removing group members
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/private/Share20')
-rw-r--r-- | lib/private/Share20/Hooks.php | 2 | ||||
-rw-r--r-- | lib/private/Share20/UserRemovedListener.php | 47 |
2 files changed, 48 insertions, 1 deletions
diff --git a/lib/private/Share20/Hooks.php b/lib/private/Share20/Hooks.php index 711306db6fe..0e41e20a2cd 100644 --- a/lib/private/Share20/Hooks.php +++ b/lib/private/Share20/Hooks.php @@ -31,7 +31,7 @@ class Hooks { \OC::$server->getShareManager()->groupDeleted($arguments['gid']); } - public static function post_removeFromGroup($arguments) { + public static function post_removeFromGroupLDAP($arguments) { \OC::$server->getShareManager()->userDeletedFromGroup($arguments['uid'], $arguments['gid']); } } diff --git a/lib/private/Share20/UserRemovedListener.php b/lib/private/Share20/UserRemovedListener.php new file mode 100644 index 00000000000..06ac52c05d4 --- /dev/null +++ b/lib/private/Share20/UserRemovedListener.php @@ -0,0 +1,47 @@ +<?php + +declare(strict_types=1); +/** + * @copyright Copyright (c) 2020 Joas Schilling <coding@schilljs.com> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * 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 + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +namespace OC\Share20; + +use OCP\EventDispatcher\Event; +use OCP\EventDispatcher\IEventListener; +use OCP\Group\Events\UserRemovedEvent; +use OCP\Share\IManager; + +class UserRemovedListener implements IEventListener { + + /** @var IManager */ + protected $shareManager; + + public function __construct(IManager $shareManager) { + $this->shareManager = $shareManager; + } + + public function handle(Event $event): void { + if (!$event instanceof UserRemovedEvent) { + return; + } + + $this->shareManager->userDeletedFromGroup($event->getUser()->getUID(), $event->getGroup()->getGID()); + } +} |