62 $this->server_settings = $a_server;
77 $this->user_data = $a_data;
93 include_once
'./Services/User/classes/class.ilUserImportParser.php';
94 include_once
'./Services/LDAP/classes/class.ilLDAPRoleAssignmentRules.php';
97 $importParser->setXMLContent($this->writer->xmlDumpMem(
false));
99 $importParser->setFolderId(7);
100 $importParser->startParsing();
101 $debug = $importParser->getProtocol();
102 #var_dump("<pre>",$this->writer->xmlDumpMem(),"</pre>");
115 include_once(
'./Services/Xml/classes/class.ilXmlWriter.php');
117 $this->writer->xmlStartTag(
'Users');
123 foreach($this->user_data as $external_account => $user)
125 $user[
'ilExternalAccount'] = $external_account;
128 if($user[
'ilInternalAccount'])
134 $this->writer->xmlStartTag(
'User',array(
'Id' =>
$usr_id,
'Action' =>
'Update'));
135 $this->writer->xmlElement(
'Login',array(),$user[
'ilInternalAccount']);
136 $this->writer->xmlElement(
'ExternalAccount',array(),$external_account);
137 $this->writer->xmlElement(
'AuthMode',array(type =>
'ldap'),null);
139 $rules = $this->mapping->getRulesForUpdate();
141 include_once
'./Services/LDAP/classes/class.ilLDAPRoleAssignmentRules.php';
144 $this->writer->xmlElement(
'Role',
145 array(
'Id' => $role_data[
'id'],
146 'Type' => $role_data[
'type'],
147 'Action' => $role_data[
'action']),
'');
154 $this->writer->xmlStartTag(
'User',array(
'Action' =>
'Insert'));
157 include_once
'./Services/LDAP/classes/class.ilLDAPRoleAssignmentRules.php';
160 $this->writer->xmlElement(
'Role',
161 array(
'Id' => $role_data[
'id'],
162 'Type' => $role_data[
'type'],
163 'Action' => $role_data[
'action']),
'');
166 $rules = $this->mapping->getRules();
170 $this->writer->xmlElement(
'Active',array(),
"true");
171 $this->writer->xmlElement(
'TimeLimitOwner',array(),7);
172 $this->writer->xmlElement(
'TimeLimitUnlimited',array(),1);
173 $this->writer->xmlElement(
'TimeLimitFrom',array(),time());
174 $this->writer->xmlElement(
'TimeLimitUntil',array(),time());
178 if(!$user[
'ilInternalAccount'])
180 $this->writer->xmlElement(
'AuthMode',array(
'type' =>
'ldap'),
'ldap');
181 $this->writer->xmlElement(
'ExternalAccount',array(),$external_account);
183 foreach($rules as $field =>
$data)
194 switch(strtolower($value))
198 $this->writer->xmlElement(
'Gender',array(),
'm');
204 $this->writer->xmlElement(
'Gender',array(),
'f');
211 $this->writer->xmlElement(
'Firstname',array(),$value);
215 $this->writer->xmlElement(
'Lastname',array(),$value);
219 $this->writer->xmlElement(
'Hobby',array(),$value);
223 $this->writer->xmlElement(
'Title',array(),$value);
227 $this->writer->xmlElement(
'Institution',array(),$value);
231 $this->writer->xmlElement(
'Department',array(),$value);
235 $this->writer->xmlElement(
'Street',array(),$value);
239 $this->writer->xmlElement(
'City',array(),$value);
243 $this->writer->xmlElement(
'PostalCode',array(),$value);
247 $this->writer->xmlElement(
'Country',array(),$value);
251 $this->writer->xmlElement(
'PhoneOffice',array(),$value);
255 $this->writer->xmlElement(
'PhoneHome',array(),$value);
259 $this->writer->xmlElement(
'PhoneMobile',array(),$value);
263 $this->writer->xmlElement(
'Fax',array(),$value);
267 $this->writer->xmlElement(
'Email',array(),$value);
270 case 'matriculation':
271 $this->writer->xmlElement(
'Matriculation',array(),$value);
282 if(substr($field,0,4) !=
'udf_')
286 $id_data = explode(
'_',$field);
287 if(!isset($id_data[1]))
292 $definition = $this->udf->getDefinition($id_data[1]);
293 $this->writer->xmlElement(
'UserDefinedField',array(
'Id' => $definition[
'il_id'],
294 'Name' => $definition[
'field_name']),
301 $this->writer->xmlEndTag(
'User');
306 $this->log->write(
'LDAP: Started creation of '.$cnt_create.
' users.');
310 $this->log->write(
'LDAP: Started update of '.$cnt_update.
' users.');
312 $this->writer->xmlEndTag(
'Users');
325 if(is_array($a_value))
343 $mapping = trim(strtolower($rule[
'value']));
353 foreach($fields as $field)
361 return $value ? $value :
'';
368 include_once(
'Services/LDAP/classes/class.ilLDAPAttributeMapping.php');
374 include_once(
'Services/User/classes/class.ilUserDefinedFields.php');