示例#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);
 }
示例#2
0
 /**
  * checks whether a user is still existing in LDAP
  * @param string[] $user
  */
 private function checkUser(array $user)
 {
     if ($this->userBackend->userExistsOnLDAP($user['name'])) {
         //still available, all good
         return;
     }
     $this->dui->markUser($user['name']);
 }
示例#3
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     try {
         $uid = $input->getArgument('ocName');
         $this->isAllowed($input->getOption('force'));
         $this->confirmUserIsMapped($uid);
         $exists = $this->backend->userExistsOnLDAP($uid);
         if ($exists === true) {
             $output->writeln('The user is still available on LDAP.');
             return;
         }
         $this->dui->markUser($uid);
         $output->writeln('The user does not exists on LDAP anymore.');
         $output->writeln('Clean up the user\'s remnants by: ./occ user:delete "' . $uid . '"');
     } catch (\Exception $e) {
         $output->writeln('<error>' . $e->getMessage() . '</error>');
     }
 }
 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);
 }