]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix check-group --update for deleted groups
authorCôme Chilliet <come.chilliet@nextcloud.com>
Mon, 7 Aug 2023 12:06:15 +0000 (14:06 +0200)
committerCôme Chilliet <come.chilliet@nextcloud.com>
Thu, 10 Aug 2023 08:57:37 +0000 (10:57 +0200)
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
apps/user_ldap/lib/Command/CheckGroup.php

index d55b846020a0aa28e917ee3058f78332cae705a6..68f96512a9b5da2430949227128b9780f0051153 100644 (file)
@@ -100,11 +100,19 @@ class CheckGroup extends Command {
                                $output->writeln('The group is still available on LDAP.');
                                if ($input->getOption('update')) {
                                        $this->backend->getLDAPAccess($gid)->connection->clearCache();
-                                       $this->updateGroup($gid, $output, $wasMapped);
+                                       if ($wasMapped) {
+                                               $this->service->handleKnownGroups([$gid]);
+                                       } else {
+                                               $this->service->handleCreatedGroups([$gid]);
+                                       }
                                }
                                return 0;
                        } elseif ($wasMapped) {
-                               $output->writeln('The group does not exists on LDAP anymore.');
+                               $output->writeln('The group does not exist on LDAP anymore.');
+                               if ($input->getOption('update')) {
+                                       $this->backend->getLDAPAccess($gid)->connection->clearCache();
+                                       $this->service->handleRemovedGroups([$gid]);
+                               }
                                return 0;
                        } else {
                                throw new \Exception('The given group is not a recognized LDAP group.');