63 $this->server_settings = $a_server;
78 $this->user_data = $a_data;
94 include_once
'./Services/User/classes/class.ilUserImportParser.php';
95 include_once
'./Services/LDAP/classes/class.ilLDAPRoleAssignmentRules.php';
98 $importParser->setXMLContent($this->writer->xmlDumpMem(
false));
100 $importParser->setFolderId(7);
101 $importParser->startParsing();
102 $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)
126 $user[
'ilExternalAccount'] = $external_account;
129 if(
$user[
'ilInternalAccount'])
135 $this->writer->xmlStartTag(
'User',array(
'Id' =>
$usr_id,
'Action' =>
'Update'));
136 $this->writer->xmlElement(
'Login',array(),
$user[
'ilInternalAccount']);
137 $this->writer->xmlElement(
'ExternalAccount',array(),$external_account);
138 $this->writer->xmlElement(
'AuthMode',array(type =>
'ldap'),null);
140 $rules = $this->mapping->getRulesForUpdate();
142 include_once
'./Services/LDAP/classes/class.ilLDAPRoleAssignmentRules.php';
145 $this->writer->xmlElement(
'Role',
146 array(
'Id' => $role_data[
'id'],
147 'Type' => $role_data[
'type'],
148 'Action' => $role_data[
'action']),
'');
155 $this->writer->xmlStartTag(
'User',array(
'Action' =>
'Insert'));
158 include_once
'./Services/LDAP/classes/class.ilLDAPRoleAssignmentRules.php';
161 $this->writer->xmlElement(
'Role',
162 array(
'Id' => $role_data[
'id'],
163 'Type' => $role_data[
'type'],
164 'Action' => $role_data[
'action']),
'');
167 $rules = $this->mapping->getRules();
171 $this->writer->xmlElement(
'Active',array(),
"true");
172 $this->writer->xmlElement(
'TimeLimitOwner',array(),7);
173 $this->writer->xmlElement(
'TimeLimitUnlimited',array(),1);
174 $this->writer->xmlElement(
'TimeLimitFrom',array(),time());
175 $this->writer->xmlElement(
'TimeLimitUntil',array(),time());
179 if(!
$user[
'ilInternalAccount'])
181 $this->writer->xmlElement(
'AuthMode',array(
'type' =>
'ldap'),
'ldap');
182 $this->writer->xmlElement(
'ExternalAccount',array(),$external_account);
184 foreach($rules as $field =>
$data)
195 switch(strtolower($value))
199 $this->writer->xmlElement(
'Gender',array(),
'm');
205 $this->writer->xmlElement(
'Gender',array(),
'f');
212 $this->writer->xmlElement(
'Firstname',array(),$value);
216 $this->writer->xmlElement(
'Lastname',array(),$value);
220 $this->writer->xmlElement(
'Hobby',array(),$value);
224 $this->writer->xmlElement(
'Title',array(),$value);
228 $this->writer->xmlElement(
'Institution',array(),$value);
232 $this->writer->xmlElement(
'Department',array(),$value);
236 $this->writer->xmlElement(
'Street',array(),$value);
240 $this->writer->xmlElement(
'City',array(),$value);
244 $this->writer->xmlElement(
'PostalCode',array(),$value);
248 $this->writer->xmlElement(
'Country',array(),$value);
252 $this->writer->xmlElement(
'PhoneOffice',array(),$value);
256 $this->writer->xmlElement(
'PhoneHome',array(),$value);
260 $this->writer->xmlElement(
'PhoneMobile',array(),$value);
264 $this->writer->xmlElement(
'Fax',array(),$value);
268 $this->writer->xmlElement(
'Email',array(),$value);
271 case 'matriculation':
272 $this->writer->xmlElement(
'Matriculation',array(),$value);
283 if(substr($field,0,4) !=
'udf_')
287 $id_data = explode(
'_',$field);
288 if(!isset($id_data[1]))
293 $definition = $this->udf->getDefinition($id_data[1]);
294 $this->writer->xmlElement(
'UserDefinedField',array(
'Id' => $definition[
'il_id'],
295 'Name' => $definition[
'field_name']),
302 $this->writer->xmlEndTag(
'User');
307 $this->log->write(
'LDAP: Started creation of '.$cnt_create.
' users.');
311 $this->log->write(
'LDAP: Started update of '.$cnt_update.
' users.');
313 $this->writer->xmlEndTag(
'Users');
326 if(is_array($a_value))
344 $mapping = trim(strtolower($rule[
'value']));
354 foreach($fields as $field)
362 return $value ? $value :
'';
369 include_once(
'Services/LDAP/classes/class.ilLDAPAttributeMapping.php');
375 include_once(
'Services/User/classes/class.ilUserDefinedFields.php');