Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2016-01-07 10:45:06 +0300
committerThomas Müller <thomas.mueller@tmit.eu>2016-01-07 10:45:06 +0300
commit470bf234c545ae5d0ad9c73834f8a596593791d6 (patch)
treead2d33ab7d744d74fafac968130761ccb2bced86
parent27dfa74d89c7c7b68f606172bf8a0275d6e81329 (diff)
parent064580a56ef33e2236fe4b9f81c4928a61080047 (diff)
Merge pull request #21343 from owncloud/ldap-showremnants-json-output
Add an option to occ ldap:showremnants to output a json encoded array…
-rw-r--r--apps/user_ldap/command/showremnants.php26
1 files changed, 15 insertions, 11 deletions
diff --git a/apps/user_ldap/command/showremnants.php b/apps/user_ldap/command/showremnants.php
index 72217c50972..1aa3c49475f 100644
--- a/apps/user_ldap/command/showremnants.php
+++ b/apps/user_ldap/command/showremnants.php
@@ -24,6 +24,7 @@ namespace OCA\user_ldap\Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use OCA\user_ldap\lib\user\DeletedUsersIndex;
@@ -50,7 +51,7 @@ class ShowRemnants extends Command {
$this
->setName('ldap:show-remnants')
->setDescription('shows which users are not available on LDAP anymore, but have remnants in ownCloud.')
- ;
+ ->addOption('json', null, InputOption::VALUE_NONE, 'return JSON array instead of pretty table.');
}
/**
@@ -70,18 +71,21 @@ class ShowRemnants extends Command {
$hAS = $user->getHasActiveShares() ? 'Y' : 'N';
$lastLogin = ($user->getLastLogin() > 0) ?
$this->dateFormatter->formatDate($user->getLastLogin()) : '-';
- $rows[] = array(
- $user->getOCName(),
- $user->getDisplayName(),
- $user->getUid(),
- $user->getDN(),
- $lastLogin,
- $user->getHomePath(),
- $hAS
+ $rows[] = array('ocName' => $user->getOCName(),
+ 'displayName' => $user->getDisplayName(),
+ 'uid' => $user->getUid(),
+ 'dn' => $user->getDN(),
+ 'lastLogin' => $lastLogin,
+ 'homePath' => $user->getHomePath(),
+ 'sharer' => $hAS
);
}
- $table->setRows($rows);
- $table->render($output);
+ if ($input->getOption('json')) {
+ $output->writeln(json_encode($rows));
+ } else {
+ $table->setRows($rows);
+ $table->render($output);
+ }
}
}