aboutsummaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/lib/Command/CheckGroup.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/user_ldap/lib/Command/CheckGroup.php')
-rw-r--r--apps/user_ldap/lib/Command/CheckGroup.php47
1 files changed, 14 insertions, 33 deletions
diff --git a/apps/user_ldap/lib/Command/CheckGroup.php b/apps/user_ldap/lib/Command/CheckGroup.php
index 68f96512a9b..9c7ccb9d3b3 100644
--- a/apps/user_ldap/lib/Command/CheckGroup.php
+++ b/apps/user_ldap/lib/Command/CheckGroup.php
@@ -3,29 +3,8 @@
declare(strict_types=1);
/**
- * @copyright Copyright (c) 2016, ownCloud, Inc.
- *
- * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @author Côme Chilliet <come.chilliet@nextcloud.com>
- * @author Joas Schilling <coding@schilljs.com>
- * @author Morris Jobke <hey@morrisjobke.de>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @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 <http://www.gnu.org/licenses/>
- *
+ * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\User_LDAP\Command;
@@ -106,37 +85,39 @@ class CheckGroup extends Command {
$this->service->handleCreatedGroups([$gid]);
}
}
- return 0;
- } elseif ($wasMapped) {
+ return self::SUCCESS;
+ }
+
+ if ($wasMapped) {
$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.');
+ return self::SUCCESS;
}
+
+ throw new \Exception('The given group is not a recognized LDAP group.');
} catch (\Exception $e) {
- $output->writeln('<error>' . $e->getMessage(). '</error>');
- return 1;
+ $output->writeln('<error>' . $e->getMessage() . '</error>');
+ return self::FAILURE;
}
}
public function onGroupCreatedEvent(GroupCreatedEvent $event, OutputInterface $output): void {
- $output->writeln('<info>The group '.$event->getGroup()->getGID().' was added to Nextcloud with '.$event->getGroup()->count().' users</info>');
+ $output->writeln('<info>The group ' . $event->getGroup()->getGID() . ' was added to Nextcloud with ' . $event->getGroup()->count() . ' users</info>');
}
public function onUserAddedEvent(UserAddedEvent $event, OutputInterface $output): void {
$user = $event->getUser();
$group = $event->getGroup();
- $output->writeln('<info>The user '.$user->getUID().' was added to group '.$group->getGID().'</info>');
+ $output->writeln('<info>The user ' . $user->getUID() . ' was added to group ' . $group->getGID() . '</info>');
}
public function onUserRemovedEvent(UserRemovedEvent $event, OutputInterface $output): void {
$user = $event->getUser();
$group = $event->getGroup();
- $output->writeln('<info>The user '.$user->getUID().' was removed from group '.$group->getGID().'</info>');
+ $output->writeln('<info>The user ' . $user->getUID() . ' was removed from group ' . $group->getGID() . '</info>');
}
/**