]> source.dussan.org Git - nextcloud-server.git/commitdiff
Show disabled user count in occ user:report 22301/head
authorMorris Jobke <hey@morrisjobke.de>
Wed, 19 Aug 2020 07:31:41 +0000 (09:31 +0200)
committerMorris Jobke <hey@morrisjobke.de>
Wed, 19 Aug 2020 16:24:43 +0000 (18:24 +0200)
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
core/Command/User/Report.php
core/register_command.php

index 3f15d40dba7e011a362e7ca5d3326fcd65ecfa3a..d8c6a781c43723735e2501a3a9be082e4480f6cb 100644 (file)
@@ -26,6 +26,7 @@
 
 namespace OC\Core\Command\User;
 
+use OCP\IConfig;
 use OCP\IUserManager;
 use Symfony\Component\Console\Command\Command;
 use Symfony\Component\Console\Helper\Table;
@@ -35,12 +36,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();
        }
 
@@ -72,6 +76,10 @@ class Report extends Command {
                $rows[] = array(' ');
                $rows[] = array('user directories', $userDirectoryCount);
 
+               $disabledUsers = $this->config->getUsersForUserValue('core', 'enabled', 'false');
+               $disabledUsersCount = count($disabledUsers);
+               $rows[] = ['disabled users', $disabledUsersCount];
+
                $table->setRows($rows);
                $table->render();
        }
index efa3146c49223cad1f705766ce77dc163a4cf07a..439322da9eefa36c54105a08762bbdd81ba6c3f0 100644 (file)
@@ -159,7 +159,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()));