[Pkg-owncloud-commits] [owncloud] 19/215: Check if the user exists before trying to delete him
David Prévot
taffit at moszumanska.debian.org
Tue May 5 01:01:14 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch stable8
in repository owncloud.
commit 07627084e4307e493f81c458350e8a563ac3a8fc
Author: Joas Schilling <nickvergessen at owncloud.com>
Date: Thu Apr 23 12:32:46 2015 +0200
Check if the user exists before trying to delete him
---
core/command/user/delete.php | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/core/command/user/delete.php b/core/command/user/delete.php
index 53952ce..2db80da 100644
--- a/core/command/user/delete.php
+++ b/core/command/user/delete.php
@@ -22,19 +22,20 @@
namespace OC\Core\Command\User;
+use OCP\IUserManager;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputArgument;
class Delete extends Command {
- /** @var \OC\User\Manager */
+ /** @var IUserManager */
protected $userManager;
/**
- * @param \OC\User\Manager $userManager
+ * @param IUserManager $userManager
*/
- public function __construct(\OC\User\Manager $userManager) {
+ public function __construct(IUserManager $userManager) {
$this->userManager = $userManager;
parent::__construct();
}
@@ -51,11 +52,17 @@ class Delete extends Command {
}
protected function execute(InputInterface $input, OutputInterface $output) {
- $wasSuccessful = $this->userManager->get($input->getArgument('uid'))->delete();
- if($wasSuccessful === true) {
+ $user = $this->userManager->get($input->getArgument('uid'));
+ if (is_null($user)) {
+ $output->writeln('User does not exist');
+ return;
+ }
+
+ if ($user->delete()) {
$output->writeln('The specified user was deleted');
return;
}
+
$output->writeln('<error>The specified could not be deleted. Please check the logs.</error>');
}
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list