Merge pull request #22299 from nextcloud/enh/noid/show-disabled-user-count-in-userreport

Show disabled user count in occ user:report
This commit is contained in:
Roeland Jago Douma 2020-08-19 11:23:27 +02:00 committed by GitHub
commit bc2b422508
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View File

@ -27,6 +27,7 @@
namespace OC\Core\Command\User; namespace OC\Core\Command\User;
use OCP\IConfig;
use OCP\IUserManager; use OCP\IUserManager;
use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\Table; use Symfony\Component\Console\Helper\Table;
@ -36,12 +37,15 @@ use Symfony\Component\Console\Output\OutputInterface;
class Report extends Command { class Report extends Command {
/** @var IUserManager */ /** @var IUserManager */
protected $userManager; protected $userManager;
/** @var IConfig */
private $config;
/** /**
* @param IUserManager $userManager * @param IUserManager $userManager
*/ */
public function __construct(IUserManager $userManager) { public function __construct(IUserManager $userManager, IConfig $config) {
$this->userManager = $userManager; $this->userManager = $userManager;
$this->config = $config;
parent::__construct(); parent::__construct();
} }
@ -73,6 +77,10 @@ class Report extends Command {
$rows[] = [' ']; $rows[] = [' '];
$rows[] = ['user directories', $userDirectoryCount]; $rows[] = ['user directories', $userDirectoryCount];
$disabledUsers = $this->config->getUsersForUserValue('core', 'enabled', 'false');
$disabledUsersCount = count($disabledUsers);
$rows[] = ['disabled users', $disabledUsersCount];
$table->setRows($rows); $table->setRows($rows);
$table->render(); $table->render();
return 0; return 0;

View File

@ -162,7 +162,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\Disable(\OC::$server->getUserManager()));
$application->add(new OC\Core\Command\User\Enable(\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\LastSeen(\OC::$server->getUserManager()));
$application->add(new OC\Core\Command\User\Report(\OC::$server->getUserManager())); $application->add(\OC::$server->get(\OC\Core\Command\User\Report::class));
$application->add(new OC\Core\Command\User\ResetPassword(\OC::$server->getUserManager())); $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\Setting(\OC::$server->getUserManager(), \OC::$server->getConfig(), \OC::$server->getDatabaseConnection()));
$application->add(new OC\Core\Command\User\ListCommand(\OC::$server->getUserManager(), \OC::$server->getGroupManager())); $application->add(new OC\Core\Command\User\ListCommand(\OC::$server->getUserManager(), \OC::$server->getGroupManager()));