64 $this->server_settings = $a_server;
79 $this->user_data = $a_data;
89 $this->new_user_auth_mode = $a_authmode;
113 include_once
'./Services/User/classes/class.ilUserImportParser.php';
114 include_once
'./Services/LDAP/classes/class.ilLDAPRoleAssignmentRules.php';
117 $importParser->setXMLContent($this->writer->xmlDumpMem(
false));
119 $importParser->setFolderId(7);
120 $importParser->startParsing();
121 $debug = $importParser->getProtocol();
122 #var_dump("<pre>",$this->writer->xmlDumpMem(),"</pre>");
123 #print_r($this->writer->xmlDumpMem($format));
136 include_once(
'./Services/Xml/classes/class.ilXmlWriter.php');
138 $this->writer->xmlStartTag(
'Users');
144 foreach($this->user_data as $external_account => $user)
146 $user[
'ilExternalAccount'] = $external_account;
149 if($user[
'ilInternalAccount'])
155 $this->writer->xmlStartTag(
'User',array(
'Id' =>
$usr_id,
'Action' =>
'Update'));
156 $this->writer->xmlElement(
'Login',array(),$user[
'ilInternalAccount']);
157 $this->writer->xmlElement(
'ExternalAccount',array(),$external_account);
158 $this->writer->xmlElement(
'AuthMode',array(type => $this->
getNewUserAuthMode()),null);
159 $rules = $this->mapping->getRulesForUpdate();
161 include_once
'./Services/LDAP/classes/class.ilLDAPRoleAssignmentRules.php';
164 $this->writer->xmlElement(
'Role',
165 array(
'Id' => $role_data[
'id'],
166 'Type' => $role_data[
'type'],
167 'Action' => $role_data[
'action']),
'');
174 $this->writer->xmlStartTag(
'User',array(
'Action' =>
'Insert'));
177 include_once
'./Services/LDAP/classes/class.ilLDAPRoleAssignmentRules.php';
180 $this->writer->xmlElement(
'Role',
181 array(
'Id' => $role_data[
'id'],
182 'Type' => $role_data[
'type'],
183 'Action' => $role_data[
'action']),
'');
186 $rules = $this->mapping->getRules();
190 $this->writer->xmlElement(
'Active',array(),
"true");
191 $this->writer->xmlElement(
'TimeLimitOwner',array(),7);
192 $this->writer->xmlElement(
'TimeLimitUnlimited',array(),1);
193 $this->writer->xmlElement(
'TimeLimitFrom',array(),time());
194 $this->writer->xmlElement(
'TimeLimitUntil',array(),time());
198 if(!$user[
'ilInternalAccount'])
200 $this->writer->xmlElement(
'AuthMode',
204 $this->writer->xmlElement(
'ExternalAccount',array(),$external_account);
206 foreach($rules as $field =>
$data)
217 switch(strtolower($value))
221 $this->writer->xmlElement(
'Gender',array(),
'm');
227 $this->writer->xmlElement(
'Gender',array(),
'f');
234 $this->writer->xmlElement(
'Firstname',array(),$value);
238 $this->writer->xmlElement(
'Lastname',array(),$value);
242 $this->writer->xmlElement(
'Hobby',array(),$value);
246 $this->writer->xmlElement(
'Title',array(),$value);
250 $this->writer->xmlElement(
'Institution',array(),$value);
254 $this->writer->xmlElement(
'Department',array(),$value);
258 $this->writer->xmlElement(
'Street',array(),$value);
262 $this->writer->xmlElement(
'City',array(),$value);
266 $this->writer->xmlElement(
'PostalCode',array(),$value);
270 $this->writer->xmlElement(
'Country',array(),$value);
274 $this->writer->xmlElement(
'PhoneOffice',array(),$value);
278 $this->writer->xmlElement(
'PhoneHome',array(),$value);
282 $this->writer->xmlElement(
'PhoneMobile',array(),$value);
286 $this->writer->xmlElement(
'Fax',array(),$value);
290 $this->writer->xmlElement(
'Email',array(),$value);
293 case 'matriculation':
294 $this->writer->xmlElement(
'Matriculation',array(),$value);
305 if(substr($field,0,4) !=
'udf_')
309 $id_data = explode(
'_',$field);
310 if(!isset($id_data[1]))
315 $definition = $this->udf->getDefinition($id_data[1]);
316 $this->writer->xmlElement(
'UserDefinedField',array(
'Id' => $definition[
'il_id'],
317 'Name' => $definition[
'field_name']),
324 $this->writer->xmlEndTag(
'User');
329 $this->log->write(
'LDAP: Started creation of '.$cnt_create.
' users.');
333 $this->log->write(
'LDAP: Started update of '.$cnt_update.
' users.');
335 $this->writer->xmlEndTag(
'Users');
348 if(is_array($a_value))
366 $mapping = trim(strtolower($rule[
'value']));
376 foreach($fields as $field)
384 return $value ? $value :
'';
391 include_once(
'Services/LDAP/classes/class.ilLDAPAttributeMapping.php');
397 include_once(
'Services/User/classes/class.ilUserDefinedFields.php');