/** * Handle ldap as data source * @param Auth $auth * @param string $ext_account */ protected function handleLDAPDataSource($a_auth, $ext_account) { include_once './Services/LDAP/classes/class.ilLDAPServer.php'; $server = ilLDAPServer::getInstanceByServerId(ilLDAPServer::getDataSource(AUTH_RADIUS)); $GLOBALS['ilLog']->write(__METHOD__ . 'Using ldap data source'); include_once './Services/LDAP/classes/class.ilLDAPUserSynchronisation.php'; $sync = new ilLDAPUserSynchronisation('radius', $server->getServerId()); $sync->setExternalAccount($ext_account); $sync->setUserData(array()); $sync->forceCreation($this->force_creation); try { $internal_account = $sync->sync(); } catch (UnexpectedValueException $e) { $GLOBALS['ilLog']->write(__METHOD__ . ': Login failed with message: ' . $e->getMessage()); $a_auth->status = AUTH_WRONG_LOGIN; $a_auth->logout(); return false; } catch (ilLDAPSynchronisationForbiddenException $e) { // No syncronisation allowed => create Error $GLOBALS['ilLog']->write(__METHOD__ . ': Login failed with message: ' . $e->getMessage()); $a_auth->status = AUTH_RADIUS_NO_ILIAS_USER; $a_auth->logout(); return false; } catch (ilLDAPAccountMigrationRequiredException $e) { $GLOBALS['ilLog']->write(__METHOD__ . ': Starting account migration.'); $a_auth->logout(); ilUtil::redirect('ilias.php?baseClass=ilStartUpGUI&cmdClass=ilstartupgui&cmd=showAccountMigration'); } $a_auth->setAuth($internal_account); return true; }