59 include_once
'./Services/Language/classes/class.ilLanguage.php';
65 $this->server_settings = $a_server;
80 $this->user_data = $a_data;
90 $this->new_user_auth_mode = $a_authmode;
114 include_once
'./Services/User/classes/class.ilUserImportParser.php';
115 include_once
'./Services/LDAP/classes/class.ilLDAPRoleAssignmentRules.php';
118 $importParser->setXMLContent($this->writer->xmlDumpMem(
false));
120 $importParser->setFolderId(7);
121 $importParser->startParsing();
122 $debug = $importParser->getProtocol();
123 #var_dump("<pre>",$this->writer->xmlDumpMem(),"</pre>");
124 #print_r($this->writer->xmlDumpMem($format));
137 include_once(
'./Services/Xml/classes/class.ilXmlWriter.php');
139 $this->writer->xmlStartTag(
'Users');
145 foreach($this->user_data as $external_account => $user)
147 $user[
'ilExternalAccount'] = $external_account;
150 if($user[
'ilInternalAccount'])
156 $this->writer->xmlStartTag(
'User',array(
'Id' => $usr_id,
'Action' =>
'Update'));
157 $this->writer->xmlElement(
'Login',array(),$user[
'ilInternalAccount']);
158 $this->writer->xmlElement(
'ExternalAccount',array(),$external_account);
159 $this->writer->xmlElement(
'AuthMode',array(type => $this->
getNewUserAuthMode()),null);
160 $rules = $this->mapping->getRulesForUpdate();
162 include_once
'./Services/LDAP/classes/class.ilLDAPRoleAssignmentRules.php';
165 $this->writer->xmlElement(
'Role',
166 array(
'Id' => $role_data[
'id'],
167 'Type' => $role_data[
'type'],
168 'Action' => $role_data[
'action']),
'');
175 $this->writer->xmlStartTag(
'User',array(
'Action' =>
'Insert'));
178 include_once
'./Services/LDAP/classes/class.ilLDAPRoleAssignmentRules.php';
181 $this->writer->xmlElement(
'Role',
182 array(
'Id' => $role_data[
'id'],
183 'Type' => $role_data[
'type'],
184 'Action' => $role_data[
'action']),
'');
187 $rules = $this->mapping->getRules();
191 $this->writer->xmlElement(
'Active',array(),
"true");
192 $this->writer->xmlElement(
'TimeLimitOwner',array(),7);
193 $this->writer->xmlElement(
'TimeLimitUnlimited',array(),1);
194 $this->writer->xmlElement(
'TimeLimitFrom',array(),time());
195 $this->writer->xmlElement(
'TimeLimitUntil',array(),time());
199 if(!$user[
'ilInternalAccount'])
201 $this->writer->xmlElement(
'AuthMode',
205 $this->writer->xmlElement(
'ExternalAccount',array(),$external_account);
207 foreach($rules as $field => $data)
210 if(!($value = $this->
doMapping($user,$data)))
218 switch(strtolower($value))
222 $this->writer->xmlElement(
'Gender',array(),
'm');
228 $this->writer->xmlElement(
'Gender',array(),
'f');
235 $this->writer->xmlElement(
'Firstname',array(),$value);
239 $this->writer->xmlElement(
'Lastname',array(),$value);
243 $this->writer->xmlElement(
'Hobby',array(),$value);
247 $this->writer->xmlElement(
'Title',array(),$value);
251 $this->writer->xmlElement(
'Institution',array(),$value);
255 $this->writer->xmlElement(
'Department',array(),$value);
259 $this->writer->xmlElement(
'Street',array(),$value);
263 $this->writer->xmlElement(
'City',array(),$value);
267 $this->writer->xmlElement(
'PostalCode',array(),$value);
271 $this->writer->xmlElement(
'Country',array(),$value);
275 $this->writer->xmlElement(
'PhoneOffice',array(),$value);
279 $this->writer->xmlElement(
'PhoneHome',array(),$value);
283 $this->writer->xmlElement(
'PhoneMobile',array(),$value);
287 $this->writer->xmlElement(
'Fax',array(),$value);
291 $this->writer->xmlElement(
'Email',array(),$value);
294 case 'matriculation':
295 $this->writer->xmlElement(
'Matriculation',array(),$value);
306 if(substr($field,0,4) !=
'udf_')
310 $id_data = explode(
'_',$field);
311 if(!isset($id_data[1]))
316 $definition = $this->udf->getDefinition($id_data[1]);
317 $this->writer->xmlElement(
'UserDefinedField',array(
'Id' => $definition[
'il_id'],
318 'Name' => $definition[
'field_name']),
325 $this->writer->xmlEndTag(
'User');
330 $this->log->write(
'LDAP: Started creation of '.$cnt_create.
' users.');
334 $this->log->write(
'LDAP: Started update of '.$cnt_update.
' users.');
336 $this->writer->xmlEndTag(
'Users');
349 if(is_array($a_value))
367 $mapping = trim(strtolower($rule[
'value']));
377 foreach($fields as $field)
385 return $value ? $value :
'';
392 include_once(
'Services/LDAP/classes/class.ilLDAPAttributeMapping.php');
398 include_once(
'Services/User/classes/class.ilUserDefinedFields.php');