64        $ilLog = 
$DIC[
'ilLog'];
 
   67        if (!is_object(
$lng)) {
 
   68            include_once 
'./Services/Language/classes/class.ilLanguage.php';
 
   74        $this->server_settings = $a_server;
 
  100        $this->user_data = $a_data;
 
  110        $this->new_user_auth_mode = $a_authmode;
 
  127        if (is_array($this->modes) && !in_array($a_mode, $this->modes)) {
 
  128            $this->modes[] = $a_mode;
 
  139        return is_array($this->modes) && in_array($a_mode, $this->modes);
 
  153        $rbacadmin = 
$DIC[
'rbacadmin'];
 
  157        include_once 
'./Services/User/classes/class.ilUserImportParser.php';
 
  158        include_once 
'./Services/LDAP/classes/class.ilLDAPRoleAssignmentRules.php';
 
  161        $importParser->setXMLContent($this->writer->xmlDumpMem(
false));
 
  163        $importParser->setFolderId(7);
 
  164        $importParser->startParsing();
 
  165        $debug = $importParser->getProtocol();
 
  166        #var_dump("<pre>",$this->writer->xmlDumpMem(),"</pre>");
 
  167        #print_r($this->writer->xmlDumpMem($format)); 
  180        $rules = $this->mapping->getRulesForUpdate();
 
  182        include_once 
'./Services/LDAP/classes/class.ilLDAPRoleAssignmentRules.php';
 
  189            $this->writer->xmlElement(
 
  191                array(
'Id' => $role_data[
'id'],
 
  192                    'Type' => $role_data[
'type'],
 
  193                    'Action' => $role_data[
'action']),
 
  206        include_once 
'./Services/LDAP/classes/class.ilLDAPRoleAssignmentRules.php';
 
  212            $this->writer->xmlElement(
 
  214                array(
'Id' => $role_data[
'id'],
 
  215                    'Type' => $role_data[
'type'],
 
  216                    'Action' => $role_data[
'action']),
 
  230        include_once(
'./Services/Xml/classes/class.ilXmlWriter.php');
 
  232        $this->writer->xmlStartTag(
'Users');
 
  238        foreach ($this->user_data as $external_account => $user) {
 
  239            $user[
'ilExternalAccount'] = $external_account;
 
  242            if ($user[
'ilInternalAccount']) {
 
  247                $this->writer->xmlStartTag(
'User', array(
'Id' => $usr_id,
'Action' => 
'Update'));
 
  248                $this->writer->xmlElement(
'Login', array(), $user[
'ilInternalAccount']);
 
  249                $this->writer->xmlElement(
'ExternalAccount', array(), $external_account);
 
  250                $this->writer->xmlElement(
'AuthMode', array(
'type' => $this->
getNewUserAuthMode()), 
null);
 
  257                $rules = $this->mapping->getRulesForUpdate();
 
  261                $this->writer->xmlStartTag(
'User', array(
'Action' => 
'Insert'));
 
  265                $rules = $this->mapping->getRules();
 
  268            $this->writer->xmlElement(
'Active', array(), 
"true");
 
  269            $this->writer->xmlElement(
'TimeLimitOwner', array(), 7);
 
  270            $this->writer->xmlElement(
'TimeLimitUnlimited', array(), 1);
 
  271            $this->writer->xmlElement(
'TimeLimitFrom', array(), time());
 
  272            $this->writer->xmlElement(
'TimeLimitUntil', array(), time());
 
  276            if (!$user[
'ilInternalAccount']) {
 
  277                $this->writer->xmlElement(
 
  282                $this->writer->xmlElement(
'ExternalAccount', array(), $external_account);
 
  284            foreach ($rules as $field => 
$data) {
 
  292                        switch (strtolower($value)) {
 
  296                                $this->writer->xmlElement(
'Gender', array(), 
'm');
 
  301                                $this->writer->xmlElement(
'Gender', array(), 
'f');
 
  305                            $this->writer->xmlElement(
'Gender', array(), 
'n');
 
  312                        $this->writer->xmlElement(
'Firstname', array(), $value);
 
  316                        $this->writer->xmlElement(
'Lastname', array(), $value);
 
  320                        $this->writer->xmlElement(
'Hobby', array(), $value);
 
  324                        $this->writer->xmlElement(
'Title', array(), $value);
 
  328                        $this->writer->xmlElement(
'Institution', array(), $value);
 
  332                        $this->writer->xmlElement(
'Department', array(), $value);
 
  336                        $this->writer->xmlElement(
'Street', array(), $value);
 
  340                        $this->writer->xmlElement(
'City', array(), $value);
 
  344                        $this->writer->xmlElement(
'PostalCode', array(), $value);
 
  348                        $this->writer->xmlElement(
'Country', array(), $value);
 
  352                        $this->writer->xmlElement(
'PhoneOffice', array(), $value);
 
  356                        $this->writer->xmlElement(
'PhoneHome', array(), $value);
 
  360                        $this->writer->xmlElement(
'PhoneMobile', array(), $value);
 
  364                        $this->writer->xmlElement(
'Fax', array(), $value);
 
  368                        $this->writer->xmlElement(
'Email', array(), $value);
 
  371                    case 'matriculation':
 
  372                        $this->writer->xmlElement(
'Matriculation', array(), $value);
 
  383                        if (substr($field, 0, 4) != 
'udf_') {
 
  386                        $id_data = explode(
'_', $field);
 
  387                        if (!isset($id_data[1])) {
 
  391                        $definition = $this->udf->getDefinition($id_data[1]);
 
  392                        $this->writer->xmlElement(
 
  394                            array(
'Id' => $definition[
'il_id'],
 
  395                                                                            'Name' => $definition[
'field_name']),
 
  403            $this->writer->xmlEndTag(
'User');
 
  407            $this->log->write(
'LDAP: Started creation of ' . $cnt_create . 
' users.');
 
  410            $this->log->write(
'LDAP: Started update of ' . $cnt_update . 
' users.');
 
  412        $this->writer->xmlEndTag(
'Users');
 
  425        if (is_array($a_value)) {
 
  440        $mapping = trim(strtolower($rule[
'value']));
 
  442        if (strpos(
$mapping, 
',') === 
false) {
 
  449        foreach ($fields as $field) {
 
  450            if (strlen($value)) {
 
  455        return $value ? $value : 
'';
 
  462        include_once(
'Services/LDAP/classes/class.ilLDAPAttributeMapping.php');
 
  468        include_once(
'Services/User/classes/class.ilUserDefinedFields.php');
 
An exception for terminatinating execution or to throw for unit testing.
static _generateLogin($a_login)
generate free login by starting with a default string and adding postfix numbers
static _getInstanceByServerId($a_server_id)
Get instance of class.
Update/create ILIAS user account by given LDAP attributes according to user attribute mapping setting...
initLDAPAttributeMapping()
isModeActive($a_mode)
Check if mode is active.
setUserData($a_data)
Set user data received from pear auth or by ldap_search.
__construct(ilLDAPServer $a_server)
Construct of ilLDAPAttribute2XML Defines between LDAP and ILIAS user attributes.
setNewUserAuthMode($a_authmode)
Set auth mode for new users.
parseRoleAssignmentsForCreation($a_external_account, $a_user)
Parse role assignments for update of user account.
convertInput($a_value)
A value can be an array or a string This function converts arrays to strings.
const MODE_INITIALIZE_ROLES
usersToXML()
Create xml string of user according to mapping rules.
getNewUserAuthMode()
Get auth mode for new users.
addMode($a_mode)
Add import mode.
getServer()
Get server settings.
parseRoleAssignmentsForUpdate($a_usr_id, $a_external_account, $user)
Parse role assignments for update of user account.
refresh()
Create/Update non existing users.
doMapping($user, $rule)
doMapping
static getAllPossibleRoles($a_server_id)
Get all assignable roles (used for import parser)
static getAssignmentsForUpdate($a_server_id, $a_usr_id, $a_usr_name, $a_usr_data)
@global type $ilDB @global type $rbacadmin @global type $rbacreview @global type $ilSetting @global t...
static getAssignmentsForCreation($a_server_id, $a_usr_name, $a_usr_data)
static _lookupId($a_user_str)
Lookup id by login.
static _getInstance()
Get instance.