From 6c99bd00424892b3fbb9431b0ada65932aa90c33 Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Wed, 19 Aug 2020 09:31:41 +0200 Subject: [PATCH] Show disabled user count in occ user:report Signed-off-by: Morris Jobke --- core/Command/User/Report.php | 10 +++++++++- core/register_command.php | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/core/Command/User/Report.php b/core/Command/User/Report.php index fff3924d32..99676253b7 100644 --- a/core/Command/User/Report.php +++ b/core/Command/User/Report.php @@ -27,6 +27,7 @@ namespace OC\Core\Command\User; +use OCP\IConfig; use OCP\IUserManager; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Helper\Table; @@ -36,12 +37,15 @@ use Symfony\Component\Console\Output\OutputInterface; class Report extends Command { /** @var IUserManager */ protected $userManager; + /** @var IConfig */ + private $config; /** * @param IUserManager $userManager */ - public function __construct(IUserManager $userManager) { + public function __construct(IUserManager $userManager, IConfig $config) { $this->userManager = $userManager; + $this->config = $config; parent::__construct(); } @@ -73,6 +77,10 @@ class Report extends Command { $rows[] = [' ']; $rows[] = ['user directories', $userDirectoryCount]; + $disabledUsers = $this->config->getUsersForUserValue('core', 'enabled', 'false'); + $disabledUsersCount = count($disabledUsers); + $rows[] = ['disabled users', $disabledUsersCount]; + $table->setRows($rows); $table->render(); } diff --git a/core/register_command.php b/core/register_command.php index e355d1429c..7215acd68d 100644 --- a/core/register_command.php +++ b/core/register_command.php @@ -160,7 +160,7 @@ if (\OC::$server->getConfig()->getSystemValue('installed', false)) { $application->add(new OC\Core\Command\User\Disable(\OC::$server->getUserManager())); $application->add(new OC\Core\Command\User\Enable(\OC::$server->getUserManager())); $application->add(new OC\Core\Command\User\LastSeen(\OC::$server->getUserManager())); - $application->add(new OC\Core\Command\User\Report(\OC::$server->getUserManager())); + $application->add(\OC::$server->query(\OC\Core\Command\User\Report::class)); $application->add(new OC\Core\Command\User\ResetPassword(\OC::$server->getUserManager())); $application->add(new OC\Core\Command\User\Setting(\OC::$server->getUserManager(), \OC::$server->getConfig(), \OC::$server->getDatabaseConnection())); $application->add(new OC\Core\Command\User\ListCommand(\OC::$server->getUserManager(), \OC::$server->getGroupManager()));