62 if (!is_object($lng)) {
63 include_once
'./Services/Language/classes/class.ilLanguage.php';
69 $this->server_settings = $a_server;
95 $this->user_data = $a_data;
105 $this->new_user_auth_mode = $a_authmode;
122 if (is_array($this->modes) && !in_array($a_mode, $this->modes)) {
123 $this->modes[] = $a_mode;
134 return is_array($this->modes) && in_array($a_mode, $this->modes);
150 include_once
'./Services/User/classes/class.ilUserImportParser.php';
151 include_once
'./Services/LDAP/classes/class.ilLDAPRoleAssignmentRules.php';
154 $importParser->setXMLContent($this->writer->xmlDumpMem(
false));
156 $importParser->setFolderId(7);
157 $importParser->startParsing();
158 $debug = $importParser->getProtocol();
159 #var_dump("<pre>",$this->writer->xmlDumpMem(),"</pre>"); 160 #print_r($this->writer->xmlDumpMem($format)); 173 $rules = $this->mapping->getRulesForUpdate();
175 include_once
'./Services/LDAP/classes/class.ilLDAPRoleAssignmentRules.php';
182 $this->writer->xmlElement(
184 array(
'Id' => $role_data[
'id'],
185 'Type' => $role_data[
'type'],
186 'Action' => $role_data[
'action']),
199 include_once
'./Services/LDAP/classes/class.ilLDAPRoleAssignmentRules.php';
205 $this->writer->xmlElement(
207 array(
'Id' => $role_data[
'id'],
208 'Type' => $role_data[
'type'],
209 'Action' => $role_data[
'action']),
223 include_once(
'./Services/Xml/classes/class.ilXmlWriter.php');
225 $this->writer->xmlStartTag(
'Users');
231 foreach ($this->user_data as $external_account => $user) {
232 $user[
'ilExternalAccount'] = $external_account;
235 if ($user[
'ilInternalAccount']) {
240 $this->writer->xmlStartTag(
'User',
array(
'Id' => $usr_id,
'Action' =>
'Update'));
241 $this->writer->xmlElement(
'Login',
array(), $user[
'ilInternalAccount']);
242 $this->writer->xmlElement(
'ExternalAccount',
array(), $external_account);
250 $rules = $this->mapping->getRulesForUpdate();
254 $this->writer->xmlStartTag(
'User',
array(
'Action' =>
'Insert'));
258 $rules = $this->mapping->getRules();
261 $this->writer->xmlElement(
'Active',
array(),
"true");
262 $this->writer->xmlElement(
'TimeLimitOwner',
array(), 7);
263 $this->writer->xmlElement(
'TimeLimitUnlimited',
array(), 1);
264 $this->writer->xmlElement(
'TimeLimitFrom',
array(),
time());
265 $this->writer->xmlElement(
'TimeLimitUntil',
array(),
time());
269 if (!$user[
'ilInternalAccount']) {
270 $this->writer->xmlElement(
275 $this->writer->xmlElement(
'ExternalAccount',
array(), $external_account);
277 foreach ($rules as $field =>
$data) {
285 switch (strtolower($value)) {
288 $this->writer->xmlElement(
'Gender',
array(),
'n');
293 $this->writer->xmlElement(
'Gender',
array(),
'm');
299 $this->writer->xmlElement(
'Gender',
array(),
'f');
306 $this->writer->xmlElement(
'Firstname',
array(), $value);
310 $this->writer->xmlElement(
'Lastname',
array(), $value);
314 $this->writer->xmlElement(
'Hobby',
array(), $value);
318 $this->writer->xmlElement(
'Title',
array(), $value);
322 $this->writer->xmlElement(
'Institution',
array(), $value);
326 $this->writer->xmlElement(
'Department',
array(), $value);
330 $this->writer->xmlElement(
'Street',
array(), $value);
334 $this->writer->xmlElement(
'City',
array(), $value);
338 $this->writer->xmlElement(
'PostalCode',
array(), $value);
342 $this->writer->xmlElement(
'Country',
array(), $value);
346 $this->writer->xmlElement(
'PhoneOffice',
array(), $value);
350 $this->writer->xmlElement(
'PhoneHome',
array(), $value);
354 $this->writer->xmlElement(
'PhoneMobile',
array(), $value);
358 $this->writer->xmlElement(
'Fax',
array(), $value);
362 $this->writer->xmlElement(
'Email',
array(), $value);
365 case 'matriculation':
366 $this->writer->xmlElement(
'Matriculation',
array(), $value);
377 if (substr($field, 0, 4) !=
'udf_') {
380 $id_data = explode(
'_', $field);
381 if (!isset($id_data[1])) {
385 $definition = $this->udf->getDefinition($id_data[1]);
386 $this->writer->xmlElement(
388 array(
'Id' => $definition[
'il_id'],
389 'Name' => $definition[
'field_name']),
397 $this->writer->xmlEndTag(
'User');
401 $this->log->write(
'LDAP: Started creation of ' . $cnt_create .
' users.');
404 $this->log->write(
'LDAP: Started update of ' . $cnt_update .
' users.');
406 $this->writer->xmlEndTag(
'Users');
419 if (is_array($a_value)) {
436 if (strpos(
$mapping,
',') ===
false) {
443 foreach ($fields as $field) {
444 if (strlen($value)) {
449 return $value ? $value :
'';
456 include_once(
'Services/LDAP/classes/class.ilLDAPAttributeMapping.php');
462 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 _generateLogin($a_login)
generate free login by starting with a default string and adding postfix numbers
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.
isModeActive($a_mode)
Check if mode is active.
convertInput($a_value)
A value can be an array or a string This function converts arrays to strings.
const MODE_INITIALIZE_ROLES
__construct(ilLDAPServer $a_server)
Construct of ilLDAPAttribute2XML Defines between LDAP and ILIAS user attributes.
parseRoleAssignmentsForCreation($a_external_account, $a_user)
Parse role assignments for update of user account.
initLDAPAttributeMapping()
Create styles array
The data for the language used.
refresh()
Create/Update non existing users.
parseRoleAssignmentsForUpdate($a_usr_id, $a_external_account, $user)
Parse role assignments for update of user account.
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...
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
getServer()
Get server settings.
addMode($a_mode)
Add import mode.
usersToXML()
Create xml string of user according to mapping rules.