示例#1
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']);
 }
示例#2
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>');
     }
 }
示例#3
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('ocName' => $user->getOCName(), 'displayName' => $user->getDisplayName(), 'uid' => $user->getUID(), 'dn' => $user->getDN(), 'lastLogin' => $lastLogin, 'homePath' => $user->getHomePath(), 'sharer' => $hAS);
     }
     if ($input->getOption('json')) {
         $output->writeln(json_encode($rows));
     } else {
         $table->setRows($rows);
         $table->render($output);
     }
 }