mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
inject and use user manager to delete command instead of using old static oc_user way
This commit is contained in:
parent
b9235e2a24
commit
ae9c9a46b8
2 changed files with 13 additions and 2 deletions
|
|
@ -14,6 +14,17 @@ use Symfony\Component\Console\Output\OutputInterface;
|
|||
use Symfony\Component\Console\Input\InputArgument;
|
||||
|
||||
class Delete extends Command {
|
||||
/** @var \OC\User\Manager */
|
||||
protected $userManager;
|
||||
|
||||
/**
|
||||
* @param \OC\User\Manager $userManager
|
||||
*/
|
||||
public function __construct(\OC\User\Manager $userManager) {
|
||||
$this->userManager = $userManager;
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
protected function configure() {
|
||||
$this
|
||||
->setName('user:delete')
|
||||
|
|
@ -26,7 +37,7 @@ class Delete extends Command {
|
|||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output) {
|
||||
$wasSuccessful = \OC_User::deleteUser($input->getArgument('uid'));
|
||||
$wasSuccessful = $this->userManager->get($input->getArgument('uid'))->delete();
|
||||
if($wasSuccessful === true) {
|
||||
$output->writeln('The specified user was deleted');
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -22,6 +22,6 @@ $application->add(new OC\Core\Command\Maintenance\Repair($repair, \OC::$server->
|
|||
$application->add(new OC\Core\Command\User\Report());
|
||||
$application->add(new OC\Core\Command\User\ResetPassword(\OC::$server->getUserManager()));
|
||||
$application->add(new OC\Core\Command\User\LastSeen());
|
||||
$application->add(new OC\Core\Command\User\Delete());
|
||||
$application->add(new OC\Core\Command\User\Delete(\OC::$server->getUserManager()));
|
||||
$application->add(new OC\Core\Command\L10n\CreateJs());
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue