Exemplo n.º 1
0
 /**
  * executes the command, i.e. creeates and outputs a table of LDAP users marked as deleted
  *
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     /** @var \Symfony\Component\Console\Helper\Table $table */
     $table = $this->getHelperSet()->get('table');
     $table->setHeaders(array('ownCloud name', 'Display Name', 'LDAP UID', 'LDAP DN', 'Last Login', 'Dir', 'Sharer'));
     $rows = array();
     $resultSet = $this->dui->getUsers();
     foreach ($resultSet as $user) {
         $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);
     }
     $table->setRows($rows);
     $table->render($output);
 }
Exemplo n.º 2
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $dui = new DeletedUsersIndex(new \OC\Preferences(\OC_DB::getConnection()), \OC::$server->getDatabaseConnection(), $this->getAccess());
     /** @var \Symfony\Component\Console\Helper\Table $table */
     $table = $this->getHelperSet()->get('table');
     $table->setHeaders(array('ownCloud name', 'Display Name', 'LDAP UID', 'LDAP DN', 'Last Login', 'Dir', 'Sharer'));
     $rows = array();
     $offset = 0;
     do {
         $resultSet = $dui->getUsers($offset);
         $offset += count($resultSet);
         foreach ($resultSet as $user) {
             $hAS = $user->getHasActiveShares() ? 'Y' : 'N';
             $lastLogin = $user->getLastLogin() > 0 ? \OCP\Util::formatDate($user->getLastLogin()) : '-';
             $rows[] = array($user->getOCName(), $user->getDisplayName(), $user->getUid(), $user->getDN(), $lastLogin, $user->getHomePath(), $hAS);
         }
     } while (count($resultSet) === 10);
     $table->setRows($rows);
     $table->render($output);
 }