summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@owncloud.com>2015-01-07 12:21:28 +0100
committerArthur Schiwon <blizzz@owncloud.com>2015-01-07 12:21:28 +0100
commitae9c9a46b8f11a0f548dfbbc23d3c215910130aa (patch)
tree251521ee2b16e8cf13cc8d488b3dd975601e02c2
parentb9235e2a24ada2bf69fc23cd83405661bde7f0da (diff)
downloadnextcloud-server-ae9c9a46b8f11a0f548dfbbc23d3c215910130aa.tar.gz
nextcloud-server-ae9c9a46b8f11a0f548dfbbc23d3c215910130aa.zip
inject and use user manager to delete command instead of using old static oc_user way
-rw-r--r--core/command/user/delete.php13
-rw-r--r--core/register_command.php2
2 files changed, 13 insertions, 2 deletions
diff --git a/core/command/user/delete.php b/core/command/user/delete.php
index f64b40e4921..d5ec3ee0bde 100644
--- a/core/command/user/delete.php
+++ b/core/command/user/delete.php
@@ -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;
diff --git a/core/register_command.php b/core/register_command.php
index 690e9879c47..5aa55be3e2c 100644
--- a/core/register_command.php
+++ b/core/register_command.php
@@ -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());