63 $this->server_settings = $a_server;
79 $this->user_data = $a_data;
95 include_once
'./Services/User/classes/class.ilUserImportParser.php';
97 $importParser->setXMLContent($this->writer->xmlDumpMem(
false));
98 $importParser->setRoleAssignment($this->role_assignment->getPossibleRoles());
99 $importParser->setFolderId(7);
100 $importParser->startParsing();
101 $debug = $importParser->getProtocol();
103 #var_dump("<pre>",$this->writer->xmlDumpMem(),"</pre>");
116 include_once(
'classes/class.ilXmlWriter.php');
118 $this->writer->xmlStartTag(
'Users');
124 foreach($this->user_data as $external_account =>
$user)
127 if(
$user[
'ilInternalAccount'])
133 $this->writer->xmlStartTag(
'User',array(
'Id' => $usr_id,
'Action' =>
'Update'));
134 $this->writer->xmlElement(
'Login',array(),
$user[
'ilInternalAccount']);
135 $this->writer->xmlElement(
'ExternalAccount',array(),$external_account);
136 $this->writer->xmlElement(
'AuthMode',array(type =>
'ldap'),null);
138 $rules = $this->mapping->getRulesForUpdate();
144 $this->writer->xmlStartTag(
'User',array(
'Action' =>
'Insert'));
147 $rules = $this->mapping->getRules();
150 $roles = $this->role_assignment->assignedRoles($external_account,
$user);
151 foreach($roles as $role_data)
153 $this->writer->xmlElement(
'Role',
154 array(
'Id' => $role_data[
'id'],
155 'Type' => $role_data[
'type'],
156 'Action' => $role_data[
'action']),
'');
160 $this->writer->xmlElement(
'Active',array(),
"true");
161 $this->writer->xmlElement(
'TimeLimitOwner',array(),7);
162 $this->writer->xmlElement(
'TimeLimitUnlimited',array(),1);
163 $this->writer->xmlElement(
'TimeLimitFrom',array(),time());
164 $this->writer->xmlElement(
'TimeLimitUntil',array(),time());
168 if(!
$user[
'ilInternalAccount'])
170 $this->writer->xmlElement(
'AuthMode',array(
'type' =>
'ldap'),
'ldap');
171 $this->writer->xmlElement(
'ExternalAccount',array(),$external_account);
173 foreach($rules as $field =>
$data)
184 switch(strtolower($value))
188 $this->writer->xmlElement(
'Gender',array(),
'm');
194 $this->writer->xmlElement(
'Gender',array(),
'f');
201 $this->writer->xmlElement(
'Firstname',array(),$value);
205 $this->writer->xmlElement(
'Lastname',array(),$value);
209 $this->writer->xmlElement(
'Hobby',array(),$value);
213 $this->writer->xmlElement(
'Title',array(),$value);
217 $this->writer->xmlElement(
'Institution',array(),$value);
221 $this->writer->xmlElement(
'Department',array(),$value);
225 $this->writer->xmlElement(
'Street',array(),$value);
229 $this->writer->xmlElement(
'City',array(),$value);
233 $this->writer->xmlElement(
'PostalCode',array(),$value);
237 $this->writer->xmlElement(
'Country',array(),$value);
241 $this->writer->xmlElement(
'PhoneOffice',array(),$value);
245 $this->writer->xmlElement(
'PhoneHome',array(),$value);
249 $this->writer->xmlElement(
'PhoneMobile',array(),$value);
253 $this->writer->xmlElement(
'Fax',array(),$value);
257 $this->writer->xmlElement(
'Email',array(),$value);
260 case 'matriculation':
261 $this->writer->xmlElement(
'Matriculation',array(),$value);
272 if(substr($field,0,4) !=
'udf_')
276 $id_data = explode(
'_',$field);
277 if(!isset($id_data[1]))
282 $definition = $this->udf->getDefinition($id_data[1]);
283 $this->writer->xmlElement(
'UserDefinedField',array(
'Id' => $definition[
'il_id'],
284 'Name' => $definition[
'field_name']),
291 $this->writer->xmlEndTag(
'User');
296 $this->log->write(
'LDAP: Started creation of '.$cnt_create.
' users.');
300 $this->log->write(
'LDAP: Started update of '.$cnt_update.
' users.');
302 $this->writer->xmlEndTag(
'Users');
315 if(is_array($a_value))
333 $mapping = trim(strtolower($rule[
'value']));
343 foreach($fields as $field)
351 return $value ? $value :
'';
362 include_once(
'Services/LDAP/classes/class.ilLDAPRoleAssignments.php');
369 include_once(
'Services/LDAP/classes/class.ilLDAPAttributeMapping.php');
375 include_once(
'Services/User/classes/class.ilUserDefinedFields.php');