Skip to content
Snippets Groups Projects
Commit ae9c9a46 authored by Arthur Schiwon's avatar Arthur Schiwon
Browse files

inject and use user manager to delete command instead of using old static oc_user way

parent b9235e2a
No related branches found
No related tags found
No related merge requests found
......@@ -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());
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment