59 include_once
'./Services/Language/classes/class.ilLanguage.php';
65 $this->server_settings = $a_server;
91 $this->user_data = $a_data;
101 $this->new_user_auth_mode = $a_authmode;
125 include_once
'./Services/User/classes/class.ilUserImportParser.php';
126 include_once
'./Services/LDAP/classes/class.ilLDAPRoleAssignmentRules.php';
129 $importParser->setXMLContent($this->writer->xmlDumpMem(
false));
131 $importParser->setFolderId(7);
132 $importParser->startParsing();
133 $debug = $importParser->getProtocol();
134 #var_dump("<pre>",$this->writer->xmlDumpMem(),"</pre>"); 135 #print_r($this->writer->xmlDumpMem($format)); 148 include_once(
'./Services/Xml/classes/class.ilXmlWriter.php');
150 $this->writer->xmlStartTag(
'Users');
156 foreach($this->user_data as $external_account => $user)
158 $user[
'ilExternalAccount'] = $external_account;
161 if($user[
'ilInternalAccount'])
167 $this->writer->xmlStartTag(
'User',array(
'Id' => $usr_id,
'Action' =>
'Update'));
168 $this->writer->xmlElement(
'Login',array(),$user[
'ilInternalAccount']);
169 $this->writer->xmlElement(
'ExternalAccount',array(),$external_account);
170 $this->writer->xmlElement(
'AuthMode',array(type => $this->
getNewUserAuthMode()),null);
171 $rules = $this->mapping->getRulesForUpdate();
173 include_once
'./Services/LDAP/classes/class.ilLDAPRoleAssignmentRules.php';
178 $user) as $role_data)
180 $this->writer->xmlElement(
'Role',
181 array(
'Id' => $role_data[
'id'],
182 'Type' => $role_data[
'type'],
183 'Action' => $role_data[
'action']),
'');
190 $this->writer->xmlStartTag(
'User',array(
'Action' =>
'Insert'));
193 include_once
'./Services/LDAP/classes/class.ilLDAPRoleAssignmentRules.php';
197 $user) as $role_data)
199 $this->writer->xmlElement(
'Role',
200 array(
'Id' => $role_data[
'id'],
201 'Type' => $role_data[
'type'],
202 'Action' => $role_data[
'action']),
'');
205 $rules = $this->mapping->getRules();
209 $this->writer->xmlElement(
'Active',array(),
"true");
210 $this->writer->xmlElement(
'TimeLimitOwner',array(),7);
211 $this->writer->xmlElement(
'TimeLimitUnlimited',array(),1);
212 $this->writer->xmlElement(
'TimeLimitFrom',array(),time());
213 $this->writer->xmlElement(
'TimeLimitUntil',array(),time());
217 if(!$user[
'ilInternalAccount'])
219 $this->writer->xmlElement(
'AuthMode',
223 $this->writer->xmlElement(
'ExternalAccount',array(),$external_account);
225 foreach($rules as $field =>
$data)
236 switch(strtolower($value))
240 $this->writer->xmlElement(
'Gender',array(),
'm');
246 $this->writer->xmlElement(
'Gender',array(),
'f');
253 $this->writer->xmlElement(
'Firstname',array(),$value);
257 $this->writer->xmlElement(
'Lastname',array(),$value);
261 $this->writer->xmlElement(
'Hobby',array(),$value);
265 $this->writer->xmlElement(
'Title',array(),$value);
269 $this->writer->xmlElement(
'Institution',array(),$value);
273 $this->writer->xmlElement(
'Department',array(),$value);
277 $this->writer->xmlElement(
'Street',array(),$value);
281 $this->writer->xmlElement(
'City',array(),$value);
285 $this->writer->xmlElement(
'PostalCode',array(),$value);
289 $this->writer->xmlElement(
'Country',array(),$value);
293 $this->writer->xmlElement(
'PhoneOffice',array(),$value);
297 $this->writer->xmlElement(
'PhoneHome',array(),$value);
301 $this->writer->xmlElement(
'PhoneMobile',array(),$value);
305 $this->writer->xmlElement(
'Fax',array(),$value);
309 $this->writer->xmlElement(
'Email',array(),$value);
312 case 'matriculation':
313 $this->writer->xmlElement(
'Matriculation',array(),$value);
324 if(substr($field,0,4) !=
'udf_')
328 $id_data = explode(
'_',$field);
329 if(!isset($id_data[1]))
334 $definition = $this->udf->getDefinition($id_data[1]);
335 $this->writer->xmlElement(
'UserDefinedField',array(
'Id' => $definition[
'il_id'],
336 'Name' => $definition[
'field_name']),
343 $this->writer->xmlEndTag(
'User');
348 $this->log->write(
'LDAP: Started creation of '.$cnt_create.
' users.');
352 $this->log->write(
'LDAP: Started update of '.$cnt_update.
' users.');
354 $this->writer->xmlEndTag(
'Users');
367 if(is_array($a_value))
385 $mapping = trim(strtolower($rule[
'value']));
395 foreach($fields as $field)
403 return $value ? $value :
'';
410 include_once(
'Services/LDAP/classes/class.ilLDAPAttributeMapping.php');
416 include_once(
'Services/User/classes/class.ilUserDefinedFields.php');
static getAssignmentsForCreation($a_server_id, $a_usr_name, $a_usr_data)
static _getInstance()
Get instance.
static _getInstanceByServerId($a_server_id)
Get instance of class.
doMapping($user, $rule)
doMapping
static _lookupId($a_user_str)
Lookup id by login.
static getAssignmentsForUpdate($a_server_id, $a_usr_id, $a_usr_name, $a_usr_data)
type $ilDB type $rbacadmin type $rbacreview type $ilSetting type $ilLog
setUserData($a_data)
Set user data received from pear auth or by ldap_search.
convertInput($a_value)
A value can be an array or a string This function converts arrays to strings.
_generateLogin($a_login)
generate free login by starting with a default string and adding postfix numbers
__construct(ilLDAPServer $a_server)
Construct of ilLDAPAttribute2XML Defines between LDAP and ILIAS user attributes.
initLDAPAttributeMapping()
refresh()
Create/Update non existing users.
getNewUserAuthMode()
Get auth mode for new users.
static getAllPossibleRoles($a_server_id)
Get all assignable roles (used for import parser)
setNewUserAuthMode($a_authmode)
Set auth mode for new users.
Update/create ILIAS user account by given LDAP attributes according to user attribute mapping setting...
getServer()
Get server settings.
usersToXML()
Create xml string of user according to mapping rules.