Ejemplo n.º 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']);
 }
Ejemplo n.º 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>');
     }
 }
Ejemplo n.º 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;
         }
         // TODO FIXME consolidate next line in DeletedUsersIndex
         // (impractical now, because of class dependencies)
         $this->config->setUserValue($uid, 'user_ldap', 'isDeleted', '1');
         $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>');
     }
 }
Ejemplo n.º 4
0
 /**
  * listens to a hook thrown by server2server sharing and replaces the given
  * login name by a username, if it matches an LDAP user.
  *
  * @param array $param
  * @throws \Exception
  */
 public static function loginName2UserName($param)
 {
     if (!isset($param['uid'])) {
         throw new \Exception('key uid is expected to be set in $param');
     }
     //ain't it ironic?
     $helper = new Helper();
     $configPrefixes = $helper->getServerConfigurationPrefixes(true);
     $ldapWrapper = new LDAP();
     $ocConfig = \OC::$server->getConfig();
     $userBackend = new User_Proxy($configPrefixes, $ldapWrapper, $ocConfig);
     $uid = $userBackend->loginName2UserName($param['uid']);
     if ($uid !== false) {
         $param['uid'] = $uid;
     }
 }