/** * Create user account * @param type $a_person_id */ private function createMember($a_person_id) { try { include_once './Services/LDAP/classes/class.ilLDAPServer.php'; $server = ilLDAPServer::getInstanceByServerId(ilLDAPServer::_getFirstActiveServer()); $server->doConnectionCheck(); include_once './Services/LDAP/classes/class.ilLDAPQuery.php'; $query = new ilLDAPQuery($server); $query->bind(IL_LDAP_BIND_DEFAULT); $users = $query->fetchUser($a_person_id); if ($users) { include_once './Services/LDAP/classes/class.ilLDAPAttributeToUser.php'; $xml = new ilLDAPAttributeToUser($server); $xml->setNewUserAuthMode($server->getAuthenticationMappingKey()); $xml->setUserData($users); $xml->refresh(); } } catch (ilLDAPQueryException $exc) { $this->log->write($exc->getMessage()); } }
/** * Update user account and role assignments * @return bool */ protected function performUpdate() { #$GLOBALS['ilLog']->write(__METHOD__.': '.print_r($this->getUserData(),true)); include_once 'Services/LDAP/classes/class.ilLDAPAttributeToUser.php'; $update = new ilLDAPAttributeToUser($this->getServer()); $update->setNewUserAuthMode($this->getAuthMode()); $update->setUserData(array($this->getExternalAccount() => $this->getUserData())); $update->refresh(); // User has been created, now read internal account again $this->readInternalAccount(); return true; }