File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1919 *
2020 */
2121
22+ use OCA \CustomGroups \Hooks ;
23+
2224$ app = new \OCA \CustomGroups \Application ();
2325$ app ->registerGroupBackend ();
2426$ app ->registerNotifier ();
27+ $ app ->getContainer ()->query (Hooks::class)->register ();
2528
2629if (!\defined ('PHPUNIT ' ) && !\OC ::$ CLI ) {
2730 $ pathInfo = \OC ::$ server ->getRequest ()->getPathInfo ();
Original file line number Diff line number Diff line change 1+ <?php
2+ /**
3+ * @author Pasquale Tripodi <pasquale.tripodi@kiteworks.com>
4+ * @author Ilja Neumann <ilja.neumann@kiteworks.com>
5+ *
6+ * @copyright Copyright (c) 2024, ownCloud GmbH
7+ * @license AGPL-3.0
8+ *
9+ * This code is free software: you can redistribute it and/or modify
10+ * it under the terms of the GNU Affero General Public License, version 3,
11+ * as published by the Free Software Foundation.
12+ *
13+ * This program is distributed in the hope that it will be useful,
14+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+ * GNU Affero General Public License for more details.
17+ *
18+ * You should have received a copy of the GNU Affero General Public License, version 3,
19+ * along with this program. If not, see <http://www.gnu.org/licenses/>
20+ *
21+ */
22+
23+ namespace OCA \CustomGroups ;
24+
25+ class Hooks {
26+ public static function register (): void {
27+ \OCP \Util::connectHook (
28+ 'OC_User ' ,
29+ 'post_deleteUser ' ,
30+ self ::class,
31+ 'userDelete '
32+ );
33+ }
34+
35+ public static function userDelete ($ params ) {
36+ $ customGroupsDb = \OC ::$ server ->query (CustomGroupsDatabaseHandler::class);
37+ foreach ($ customGroupsDb ->getUserMemberships ($ params ['uid ' ], null ) as $ customgroup ) {
38+ $ customGroupsDb ->removeFromGroup ($ params ['uid ' ], $ customgroup ['group_id ' ]);
39+ }
40+ }
41+ }
You can’t perform that action at this time.
0 commit comments