ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
ilUserImportParser Class Reference

User Import Parser. More...

+ Inheritance diagram for ilUserImportParser:
+ Collaboration diagram for ilUserImportParser:

Public Member Functions

 ilUserImportParser ($a_xml_file='', $a_mode=IL_USER_IMPORT, $a_conflict_rule=IL_FAIL_ON_CONFLICT)
 Constructor. More...
 
 setFolderId ($a_folder_id)
 assign users to this folder (normally the usr_folder) But if called from local admin => the ref_id of the category public More...
 
 getFolderId ()
 
 setHandlers ($a_xml_parser)
 set event handler should be overwritten by inherited class private More...
 
 startParsing ()
 start the parser More...
 
 setRoleAssignment ($a_assign)
 set import to local role assignemt More...
 
 buildTag ($type, $name, $attr="")
 generate a tag with given name and attributes More...
 
 handlerBeginTag ($a_xml_parser, $a_name, $a_attribs)
 handler for begin of element More...
 
 extractRolesBeginTag ($a_xml_parser, $a_name, $a_attribs)
 handler for begin of element in extract roles mode More...
 
 importBeginTag ($a_xml_parser, $a_name, $a_attribs)
 handler for begin of element in user import mode More...
 
 verifyBeginTag ($a_xml_parser, $a_name, $a_attribs)
 handler for begin of element More...
 
 handlerEndTag ($a_xml_parser, $a_name)
 handler for end of element More...
 
 extractRolesEndTag ($a_xml_parser, $a_name)
 handler for end of element when in extract roles mode. More...
 
 getRoleObject ($a_role_id)
 Returns the parent object of the role folder object which contains the specified role. More...
 
 getCourseMembersObjectForRole ($a_role_id)
 Returns the parent object of the role folder object which contains the specified role. More...
 
 assignToRole ($a_user_obj, $a_role_id)
 Assigns a user to a role. More...
 
 getParentRoleIds ($a_role_id)
 Get array of parent role ids from cache. More...
 
 assignToRoleWithParents ($a_user_obj, $a_role_id)
 Assigns a user to a role and to all parent roles. More...
 
 detachFromRole ($a_user_obj, $a_role_id)
 Detachs a user from a role. More...
 
 importEndTag ($a_xml_parser, $a_name)
 handler for end of element when in import user mode. More...
 
 saveTempImage ($image_data, $filename)
 Saves binary image data to a temporary image file and returns the name of the image file on success. More...
 
 verifyEndTag ($a_xml_parser, $a_name)
 handler for end of element when in verify mode. More...
 
 handlerCharacterData ($a_xml_parser, $a_data)
 handler for character data More...
 
 getCollectedRoles ()
 get collected roles More...
 
 getUserCount ()
 get count of User elements More...
 
 logWarning ($aLogin, $aMessage)
 Writes a warning log message to the protocol. More...
 
 logFailure ($aLogin, $aMessage)
 Writes a failure log message to the protocol. More...
 
 logSuccess ($aLogin, $userid, $action)
 Writes a success log message to the protocol. More...
 
 getProtocol ()
 Returns the protocol. More...
 
 getProtocolAsHTML ($a_log_title)
 Returns the protocol as a HTML table. More...
 
 isSuccess ()
 Returns true, if the import was successful. More...
 
 getErrorLevel ()
 Returns the error level. More...
 
 getUserMapping ()
 returns a map user_id <=> login More...
 
 sendAccountMail ()
 send account mail More...
 
 setSendMail ($value)
 write access to property send mail More...
 
 isSendMail ()
 read access to property send mail More...
 
 setUserMappingMode ($value)
 write access to user mapping mode More...
 
 getUserMappingMode ()
 read access to user mapping mode More...
 
- Public Member Functions inherited from ilSaxParser
 ilSaxParser ($a_xml_file='', $throwException=false)
 Constructor setup ILIAS global object public. More...
 
 setXMLContent ($a_xml_content)
 
 getXMLContent ()
 
 getInputType ()
 
 startParsing ()
 stores xml data in array More...
 
 createParser ()
 create parser More...
 
 setOptions ($a_xml_parser)
 set parser options More...
 
 setHandlers ($a_xml_parser)
 set event handler should be overwritten by inherited class private More...
 
 openXMLFile ()
 open xml file More...
 
 parse ($a_xml_parser, $a_fp=null)
 parse xml file More...
 
 freeParser ($a_xml_parser)
 free xml parser handle More...
 
 setThrowException ($throwException)
 set error handling More...
 
- Public Member Functions inherited from PEAR
 PEAR ($error_class=null)
 Constructor. More...
 
 _PEAR ()
 Destructor (the emulated type of...). More...
 
getStaticProperty ($class, $var)
 If you have a class that's mostly/entirely static, and you need static properties, you can use this method to simulate them. More...
 
 registerShutdownFunc ($func, $args=array())
 Use this function to register a shutdown method for static classes. More...
 
 isError ($data, $code=null)
 Tell whether a value is a PEAR error. More...
 
 setErrorHandling ($mode=null, $options=null)
 Sets how errors generated by this object should be handled. More...
 
 expectError ($code=' *')
 This method is used to tell which errors you expect to get. More...
 
 popExpect ()
 This method pops one element off the expected error codes stack. More...
 
 _checkDelExpect ($error_code)
 This method checks unsets an error code if available. More...
 
 delExpect ($error_code)
 This method deletes all occurences of the specified element from the expected error codes stack. More...
 
raiseError ($message=null, $code=null, $mode=null, $options=null, $userinfo=null, $error_class=null, $skipmsg=false)
 This method is a wrapper that returns an instance of the configured error class with this object's default error handling applied. More...
 
throwError ($message=null, $code=null, $userinfo=null)
 Simpler form of raiseError with fewer options. More...
 
 staticPushErrorHandling ($mode, $options=null)
 
 staticPopErrorHandling ()
 
 pushErrorHandling ($mode, $options=null)
 Push a new error handler on top of the error handler options stack. More...
 
 popErrorHandling ()
 Pop the last error handler used. More...
 
 loadExtension ($ext)
 OS independant PHP extension load. More...
 

Data Fields

 $approve_date_set = false
 
 $time_limit_set = false
 
 $time_limit_owner_set = false
 
 $updateLookAndSkin = false
 boolean to determine if look and skin should be updated More...
 
 $folder_id
 
 $roles
 
 $action
 The Action attribute determines what to do for the current User element. More...
 
 $protocol
 The variable holds the protocol of the import. More...
 
 $logins
 This variable is used to collect each login that we encounter in the import data. More...
 
 $conflict_rule
 Conflict handling rule. More...
 
 $send_mail
 
 $error_level
 This variable is used to report the error level of the validation process or the importing process. More...
 
 $currPasswordType
 The password type of the current user. More...
 
 $currPassword
 The password of the current user. More...
 
 $currActive
 The active state of the current user. More...
 
 $userCount
 The count of user elements in the XML file. More...
 
 $user_mapping
 
 $mapping_mode
 
 $localRoleCache
 Cached local roles. More...
 
 $personalPicture
 Cached personal picture of the actual user This is used because the ilObjUser object has no field for the personal picture. More...
 
 $parentRolesCache
 Cached parent roles. More...
 
 $skin
 ILIAS skin. More...
 
 $style
 ILIAS style. More...
 
 $userStyles
 User assigned styles. More...
 
 $hideSkin
 Indicates if the skins are hidden. More...
 
 $disableSkin
 Indicates if the skins are enabled. More...
 
 $user_id
 
- Data Fields inherited from ilSaxParser
 $input_type = null
 
 $xml_content = ''
 
 $ilias
 
 $lng
 
 $xml_file
 
 $throwException = false
 
- Data Fields inherited from PEAR
 $_debug = false
 
 $_default_error_mode = null
 
 $_default_error_options = null
 
 $_default_error_handler = ''
 
 $_error_class = 'PEAR_Error'
 
 $_expected_errors = array()
 

Protected Member Functions

 isFieldRequired ($fieldname)
 determine if a field $fieldname is to a required field (global setting) More...
 
- Protected Member Functions inherited from ilSaxParser
 handleError ($message, $code)
 use given error handler to handle error message or internal ilias error message handle More...
 

Protected Attributes

 $currPasswordSalt
 

Private Member Functions

 readAccountMailFromCache ($lang_key)
 
 readRequiredFields ()
 read required fields More...
 
 checkProfileIncomplete ($user_obj)
 Check if profile is incomplete Will set the usr_data field profile_incomplete if any required field is missing. More...
 
 verifyPref ($key, $value)
 
 updateMailPreferences ($usr_id)
 

Private Attributes

 $userObj
 
 $current_messenger_type
 

Static Private Attributes

static $account_mail_cache = array()
 

Detailed Description

User Import Parser.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e

Definition at line 49 of file class.ilUserImportParser.php.

Member Function Documentation

◆ assignToRole()

ilUserImportParser::assignToRole (   $a_user_obj,
  $a_role_id 
)

Assigns a user to a role.

Definition at line 796 of file class.ilUserImportParser.php.

References $ref_id, ilObjUser\_addDesktopItem(), ilObject\_getAllReferences(), and ilObject\_lookupType().

Referenced by assignToRoleWithParents(), and importEndTag().

797  {
798  require_once "./Services/AccessControl/classes/class.ilObjRole.php";
799  include_once('./Services/Object/classes/class.ilObject.php');
800  #require_once "Modules/Course/classes/class.ilObjCourse.php";
801  #require_once "Modules/Course/classes/class.ilCourseParticipants.php";
802 
803  global $rbacreview, $rbacadmin, $tree;
804 
805  // Do nothing, if the user is already assigned to the role.
806  // Specifically, we do not want to put a course object or
807  // group object on the personal desktop again, if a user
808  // has removed it from the personal desktop.
809  if ($rbacreview->isAssigned($a_user_obj->getId(), $a_role_id))
810  {
811  return;
812  }
813 
814  // If it is a course role, use the ilCourseMember object to assign
815  // the user to the role
816 
817  $rbacadmin->assignUser($a_role_id, $a_user_obj->getId(), true);
818  $obj_id = $rbacreview->getObjectOfRole($a_role_id);
819  switch($type = ilObject::_lookupType($obj_id))
820  {
821  case 'grp':
822  case 'crs':
823  $ref_ids = ilObject::_getAllReferences($obj_id);
824  $ref_id = current((array) $ref_ids);
825  if($ref_id)
826  {
827  ilObjUser::_addDesktopItem($a_user_obj->getId(),$ref_id,$type);
828  }
829  break;
830  default:
831  break;
832  }
833  }
static _getAllReferences($a_id)
get all reference ids of object
static _lookupType($a_id, $a_reference=false)
lookup object type
static _addDesktopItem($a_usr_id, $a_item_id, $a_type, $a_par="")
add an item to user&#39;s personal desktop
$ref_id
Definition: sahs_server.php:39
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ assignToRoleWithParents()

ilUserImportParser::assignToRoleWithParents (   $a_user_obj,
  $a_role_id 
)

Assigns a user to a role and to all parent roles.

Definition at line 892 of file class.ilUserImportParser.php.

References assignToRole(), and getParentRoleIds().

Referenced by importEndTag().

893  {
894  $this->assignToRole($a_user_obj, $a_role_id);
895 
896  $parent_role_ids = $this->getParentRoleIds($a_role_id);
897  foreach ($parent_role_ids as $parent_role_id)
898  {
899  $this->assignToRole($a_user_obj, $parent_role_id);
900  }
901  }
getParentRoleIds($a_role_id)
Get array of parent role ids from cache.
assignToRole($a_user_obj, $a_role_id)
Assigns a user to a role.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildTag()

ilUserImportParser::buildTag (   $type,
  $name,
  $attr = "" 
)

generate a tag with given name and attributes

Parameters
string"start" | "end" for starting or ending tag
stringelement/tag name
arrayarray of attributes

Definition at line 406 of file class.ilUserImportParser.php.

407  {
408  $tag = "<";
409 
410  if ($type == "end")
411  $tag.= "/";
412 
413  $tag.= $name;
414 
415  if (is_array($attr))
416  {
417  while (list($k,$v) = each($attr))
418  $tag.= " ".$k."=\"$v\"";
419  }
420 
421  $tag.= ">";
422 
423  return $tag;
424  }

◆ checkProfileIncomplete()

ilUserImportParser::checkProfileIncomplete (   $user_obj)
private

Check if profile is incomplete Will set the usr_data field profile_incomplete if any required field is missing.

private

Definition at line 2345 of file class.ilUserImportParser.php.

References ilUserProfile\isProfileIncomplete().

Referenced by importEndTag().

2346  {
2347  include_once "Services/User/classes/class.ilUserProfile.php";
2348  return ilUserProfile::isProfileIncomplete($user_obj);
2349  }
static isProfileIncomplete($a_user, $a_include_udf=true, $a_personal_data_only=true)
Check if all required personal data fields are set.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ detachFromRole()

ilUserImportParser::detachFromRole (   $a_user_obj,
  $a_role_id 
)

Detachs a user from a role.

Definition at line 905 of file class.ilUserImportParser.php.

References $ref_id, ilObjUser\_dropDesktopItem(), ilObject\_getAllReferences(), ilObject\_lookupTitle(), and ilObject\_lookupType().

Referenced by importEndTag().

906  {
907  global $rbacreview, $rbacadmin, $tree;
908 
909  $rbacadmin->deassignUser($a_role_id, $a_user_obj->getId());
910 
911  if (substr(ilObject::_lookupTitle($a_role_id),0,6) == 'il_crs' or
912  substr(ilObject::_lookupTitle($a_role_id),0,6) == 'il_grp')
913  {
914  $obj = $rbacreview->getObjectOfRole($a_role_id);
915  $ref = ilObject::_getAllReferences($obj);
916  $ref_id = end($ref);
917  ilObjUser::_dropDesktopItem($a_user_obj->getId(), $ref_id, ilObject::_lookupType($obj));
918  }
919 }
static _lookupTitle($a_id)
lookup object title
static _getAllReferences($a_id)
get all reference ids of object
static _dropDesktopItem($a_usr_id, $a_item_id, $a_type)
drop an item from user&#39;s personal desktop
static _lookupType($a_id, $a_reference=false)
lookup object type
$ref_id
Definition: sahs_server.php:39
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ extractRolesBeginTag()

ilUserImportParser::extractRolesBeginTag (   $a_xml_parser,
  $a_name,
  $a_attribs 
)

handler for begin of element in extract roles mode

Definition at line 450 of file class.ilUserImportParser.php.

References ilUtil\__extractId().

Referenced by handlerBeginTag().

451  {
452  switch($a_name)
453  {
454  case "Role":
455  // detect numeric, ilias id (then extract role id) or alphanumeric
456  $this->current_role_id = $a_attribs["Id"];
457  if ($internal_id = ilUtil::__extractId($this->current_role_id, IL_INST_ID))
458  {
459  $this->current_role_id = $internal_id;
460  }
461  $this->current_role_type = $a_attribs["Type"];
462 
463  break;
464  }
465  }
static __extractId($ilias_id, $inst_id)
extract ref id from role title, e.g.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ extractRolesEndTag()

ilUserImportParser::extractRolesEndTag (   $a_xml_parser,
  $a_name 
)

handler for end of element when in extract roles mode.

Definition at line 738 of file class.ilUserImportParser.php.

Referenced by handlerEndTag().

739  {
740  switch($a_name)
741  {
742  case "Role":
743  $this->roles[$this->current_role_id]["name"] = $this->cdata;
744  $this->roles[$this->current_role_id]["type"] =
745  $this->current_role_type;
746  break;
747  }
748  }
+ Here is the caller graph for this function:

◆ getCollectedRoles()

ilUserImportParser::getCollectedRoles ( )

get collected roles

Definition at line 2079 of file class.ilUserImportParser.php.

References $roles.

2080  {
2081  return $this->roles;
2082  }

◆ getCourseMembersObjectForRole()

ilUserImportParser::getCourseMembersObjectForRole (   $a_role_id)

Returns the parent object of the role folder object which contains the specified role.

Definition at line 771 of file class.ilUserImportParser.php.

References ilCourseParticipants\_getInstanceByObjId().

772  {
773  global $rbacreview, $rbacadmin, $tree;
774 
775  if (array_key_exists($a_role_id.'_courseMembersObject', $this->localRoleCache))
776  {
777  return $this->localRoleCache[$a_role_id.'_courseMembersObject'];
778  }
779  else
780  {
781  require_once("Modules/Course/classes/class.ilObjCourse.php");
782  require_once("Modules/Course/classes/class.ilCourseParticipants.php");
783  $course_refs = $rbacreview->getFoldersAssignedToRole($a_role_id, true);
784  $course_ref = $course_refs[0];
785  $course_obj = new ilObjCourse($course_ref, true);
786  $crsmembers_obj = ilCourseParticipants::_getInstanceByObjId($course_obj->getId());
787  $this->localRoleCache[$a_role_id.'_courseMembersObject'] = $crsmembers_obj;
788  return $crsmembers_obj;
789  }
790 
791  }
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
Class ilObjCourse.
+ Here is the call graph for this function:

◆ getErrorLevel()

ilUserImportParser::getErrorLevel ( )

Returns the error level.

Returns
IL_IMPORT_SUCCESS | IL_IMPORT_WARNING | IL_IMPORT_FAILURE

Definition at line 2201 of file class.ilUserImportParser.php.

References $error_level.

2202  {
2203  return $this->error_level;
2204  }
$error_level
This variable is used to report the error level of the validation process or the importing process...

◆ getFolderId()

ilUserImportParser::getFolderId ( )

Definition at line 364 of file class.ilUserImportParser.php.

References $folder_id.

Referenced by importEndTag().

365  {
366  return $this->folder_id;
367  }
+ Here is the caller graph for this function:

◆ getParentRoleIds()

ilUserImportParser::getParentRoleIds (   $a_role_id)

Get array of parent role ids from cache.

If necessary, create a new cache entry.

Definition at line 838 of file class.ilUserImportParser.php.

References getRoleObject().

Referenced by assignToRoleWithParents().

839  {
840  global $rbacreview;
841 
842  if (! array_key_exists($a_role_id, $this->parentRolesCache))
843  {
844  $parent_role_ids = array();
845 
846  $role_obj = $this->getRoleObject($a_role_id);
847  $short_role_title = substr($role_obj->getTitle(),0,12);
848  $folders = $rbacreview->getFoldersAssignedToRole($a_role_id, true);
849  if (count($folders) > 0)
850  {
851  $all_parent_role_ids = $rbacreview->getParentRoleIds($folders[0]);
852  foreach ($all_parent_role_ids as $parent_role_id => $parent_role_data)
853  {
854  if ($parent_role_id != $a_role_id)
855  {
856  switch (substr($parent_role_data['title'],0,12))
857  {
858  case 'il_crs_admin' :
859  case 'il_grp_admin' :
860  if ($short_role_title == 'il_crs_admin' || $short_role_title == 'il_grp_admin')
861  {
862  $parent_role_ids[] = $parent_role_id;
863  }
864  break;
865  case 'il_crs_tutor' :
866  case 'il_grp_tutor' :
867  if ($short_role_title == 'il_crs_tutor' || $short_role_title == 'il_grp_tutor')
868  {
869  $parent_role_ids[] = $parent_role_id;
870  }
871  break;
872  case 'il_crs_membe' :
873  case 'il_grp_membe' :
874  if ($short_role_title == 'il_crs_membe' || $short_role_title == 'il_grp_membe')
875  {
876  $parent_role_ids[] = $parent_role_id;
877  }
878  break;
879  default :
880  break;
881  }
882  }
883  }
884  }
885  $this->parentRolesCache[$a_role_id] = $parent_role_ids;
886  }
887  return $this->parentRolesCache[$a_role_id];
888  }
getRoleObject($a_role_id)
Returns the parent object of the role folder object which contains the specified role.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getProtocol()

ilUserImportParser::getProtocol ( )

Returns the protocol.

The protocol is an associative array. Keys are login names. Values are non-associative arrays. Each array element contains an error message.

Definition at line 2152 of file class.ilUserImportParser.php.

References $protocol.

Referenced by getProtocolAsHTML().

2153  {
2154  return $this->protocol;
2155  }
$protocol
The variable holds the protocol of the import.
+ Here is the caller graph for this function:

◆ getProtocolAsHTML()

ilUserImportParser::getProtocolAsHTML (   $a_log_title)

Returns the protocol as a HTML table.

Definition at line 2159 of file class.ilUserImportParser.php.

References ilSaxParser\$lng, $messages, and getProtocol().

2160  {
2161  global $lng;
2162 
2163  $block = new ilTemplate("tpl.usr_import_log_block.html", true, true, "Services/User");
2164  $block->setVariable("TXT_LOG_TITLE", $a_log_title);
2165  $block->setVariable("TXT_MESSAGE_ID", $lng->txt("login"));
2166  $block->setVariable("TXT_MESSAGE_TEXT", $lng->txt("message"));
2167  foreach ($this->getProtocol() as $login => $messages)
2168  {
2169  $block->setCurrentBlock("log_row");
2170  $reason = "";
2171  foreach ($messages as $message)
2172  {
2173  if ($reason == "")
2174  {
2175  $reason = $message;
2176  }
2177  else
2178  {
2179  $reason = $reason."<br>".$message;
2180  }
2181  }
2182  $block->setVariable("MESSAGE_ID", $login);
2183  $block->setVariable("MESSAGE_TEXT", $reason);
2184  $block->parseCurrentBlock();
2185  }
2186  return $block->get();
2187  }
getProtocol()
Returns the protocol.
special template class to simplify handling of ITX/PEAR
$messages
Definition: en-x-test.php:7
+ Here is the call graph for this function:

◆ getRoleObject()

ilUserImportParser::getRoleObject (   $a_role_id)

Returns the parent object of the role folder object which contains the specified role.

Definition at line 753 of file class.ilUserImportParser.php.

Referenced by getParentRoleIds().

754  {
755  if (array_key_exists($a_role_id, $this->localRoleCache))
756  {
757  return $this->localRoleCache[$a_role_id];
758  }
759  else
760  {
761  $role_obj = new ilObjRole($a_role_id, false);
762  $role_obj->read();
763  $this->localRoleCache[$a_role_id] = $role_obj;
764  return $role_obj;
765  }
766 
767  }
Class ilObjRole.
+ Here is the caller graph for this function:

◆ getUserCount()

ilUserImportParser::getUserCount ( )

get count of User elements

Definition at line 2086 of file class.ilUserImportParser.php.

References $userCount.

2087  {
2088  return $this->userCount;
2089  }
$userCount
The count of user elements in the XML file.

◆ getUserMapping()

ilUserImportParser::getUserMapping ( )

returns a map user_id <=> login

Returns
assoc array, with user_id as key and login as value

Definition at line 2211 of file class.ilUserImportParser.php.

References $user_mapping.

2211  {
2212  return $this->user_mapping;
2213  }

◆ getUserMappingMode()

ilUserImportParser::getUserMappingMode ( )

read access to user mapping mode

Returns
int one of IL_USER_MAPPING_ID or IL_USER_MAPPING_LOGIN

Definition at line 2307 of file class.ilUserImportParser.php.

References $mapping_mode.

Referenced by importBeginTag(), and verifyBeginTag().

2308  {
2309  return $this->mapping_mode;
2310  }
+ Here is the caller graph for this function:

◆ handlerBeginTag()

ilUserImportParser::handlerBeginTag (   $a_xml_parser,
  $a_name,
  $a_attribs 
)

handler for begin of element

Definition at line 429 of file class.ilUserImportParser.php.

References extractRolesBeginTag(), IL_EXTRACT_ROLES, IL_USER_IMPORT, IL_VERIFY, importBeginTag(), and verifyBeginTag().

430  {
431  switch ($this->mode)
432  {
433  case IL_EXTRACT_ROLES :
434  $this->extractRolesBeginTag($a_xml_parser, $a_name, $a_attribs);
435  break;
436  case IL_USER_IMPORT :
437  $this->importBeginTag($a_xml_parser, $a_name, $a_attribs);
438  break;
439  case IL_VERIFY :
440  $this->verifyBeginTag($a_xml_parser, $a_name, $a_attribs);
441  break;
442  }
443 
444  $this->cdata = "";
445  }
verifyBeginTag($a_xml_parser, $a_name, $a_attribs)
handler for begin of element
const IL_USER_IMPORT
const IL_EXTRACT_ROLES
importBeginTag($a_xml_parser, $a_name, $a_attribs)
handler for begin of element in user import mode
extractRolesBeginTag($a_xml_parser, $a_name, $a_attribs)
handler for begin of element in extract roles mode
const IL_VERIFY
+ Here is the call graph for this function:

◆ handlerCharacterData()

ilUserImportParser::handlerCharacterData (   $a_xml_parser,
  $a_data 
)

handler for character data

Definition at line 2063 of file class.ilUserImportParser.php.

2064  {
2065  // DELETE WHITESPACES AND NEWLINES OF CHARACTER DATA
2066  // TODO: Mit Alex klären, ob das noch benötigt wird $a_data = preg_replace("/\n/","",$a_data);
2067  // TODO: Mit Alex klären, ob das noch benötigt wird $a_data = preg_replace("/\t+/","",$a_data);
2068  if($a_data != "\n") $a_data = preg_replace("/\t+/"," ",$a_data);
2069 
2070  if(strlen($a_data) > 0)
2071  {
2072  $this->cdata .= $a_data;
2073  }
2074  }

◆ handlerEndTag()

ilUserImportParser::handlerEndTag (   $a_xml_parser,
  $a_name 
)

handler for end of element

Definition at line 719 of file class.ilUserImportParser.php.

References extractRolesEndTag(), IL_EXTRACT_ROLES, IL_USER_IMPORT, IL_VERIFY, importEndTag(), and verifyEndTag().

720  {
721  switch ($this->mode)
722  {
723  case IL_EXTRACT_ROLES :
724  $this->extractRolesEndTag($a_xml_parser, $a_name);
725  break;
726  case IL_USER_IMPORT :
727  $this->importEndTag($a_xml_parser, $a_name);
728  break;
729  case IL_VERIFY :
730  $this->verifyEndTag($a_xml_parser, $a_name);
731  break;
732  }
733  }
const IL_USER_IMPORT
extractRolesEndTag($a_xml_parser, $a_name)
handler for end of element when in extract roles mode.
verifyEndTag($a_xml_parser, $a_name)
handler for end of element when in verify mode.
const IL_EXTRACT_ROLES
const IL_VERIFY
importEndTag($a_xml_parser, $a_name)
handler for end of element when in import user mode.
+ Here is the call graph for this function:

◆ ilUserImportParser()

ilUserImportParser::ilUserImportParser (   $a_xml_file = '',
  $a_mode = IL_USER_IMPORT,
  $a_conflict_rule = IL_FAIL_ON_CONFLICT 
)

Constructor.

Parameters
string$a_xml_filexml file
int$a_modeIL_EXTRACT_ROLES | IL_USER_IMPORT | IL_VERIFY
int$a_conflict_rueIL_FAIL_ON_CONFLICT | IL_UPDATE_ON_CONFLICT | IL_IGNORE_ON_CONFLICT

public

Definition at line 286 of file class.ilUserImportParser.php.

References ilSaxParser\$ilias, $ilUser, ilSaxParser\$lng, ilStyleDefinition\_getAllTemplates(), ilObjStyleSettings\_lookupActivatedStyle(), IL_IMPORT_SUCCESS, and IL_USER_MAPPING_LOGIN.

287  {
288  global $lng, $tree, $ilias, $ilUser, $styleDefinition;
289 
290  $this->roles = array();
291  $this->mode = $a_mode;
292  $this->conflict_rule = $a_conflict_rule;
293  $this->error_level = IL_IMPORT_SUCCESS;
294  $this->protocol = array();
295  $this->logins = array();
296  $this->userCount = 0;
297  $this->localRoleCache = array();
298  $this->parentRolesCache = array();
299  $this->send_mail = false;
300  $this->mapping_mode = IL_USER_MAPPING_LOGIN;
301 
302  // get all active style instead of only assigned ones -> cannot transfer all to another otherwise
303  $this->userStyles = array();
304  include_once("./Services/Style/classes/class.ilObjStyleSettings.php");
305  include_once './Services/Style/classes/class.ilStyleDefinition.php';
307 
308  if (is_array($templates))
309  {
310 
311  foreach($templates as $template)
312  {
313  // get styles information of template
314  $styleDef =& new ilStyleDefinition($template["id"]);
315  $styleDef->startParsing();
316  $styles = $styleDef->getStyles();
317 
318  foreach($styles as $style)
319  {
320  if (!ilObjStyleSettings::_lookupActivatedStyle($template["id"],$style["id"]))
321  {
322  continue;
323  }
324  $this->userStyles [] = $template["id"].":".$style["id"];
325  }
326  }
327  }
328 
329  $settings = $ilias->getAllSettings();
330  if ($settings["usr_settings_hide_skin_style"] == 1)
331  {
332  $this->hideSkin = TRUE;
333  }
334  else
335  {
336  $this->hideSkin = FALSE;
337  }
338  if ($settings["usr_settings_disable_skin_style"] == 1)
339  {
340  $this->disableSkin = TRUE;
341  }
342  else
343  {
344  $this->disableSkin = FALSE;
345  }
346 
347  include_once("Services/Mail/classes/class.ilAccountMail.php");
348  $this->acc_mail = new ilAccountMail();
349  $this->acc_mail->useLangVariablesAsFallback(true);
350 
351  parent::ilSaxParser($a_xml_file);
352  }
const IL_USER_MAPPING_LOGIN
_lookupActivatedStyle($a_skin, $a_style)
lookup if a style is activated
const IL_IMPORT_SUCCESS
global $ilUser
Definition: imgupload.php:15
Class ilAccountMail.
parses the template.xml that defines all styles of the current template
+ Here is the call graph for this function:

◆ importBeginTag()

ilUserImportParser::importBeginTag (   $a_xml_parser,
  $a_name,
  $a_attribs 
)

handler for begin of element in user import mode

Definition at line 469 of file class.ilUserImportParser.php.

References ilSaxParser\$ilias, ilSaxParser\$lng, ilUtil\__extractId(), getUserMappingMode(), IL_USER_MAPPING_ID, and logFailure().

Referenced by handlerBeginTag().

470  {
471  global $ilias,$lng;
472 
473  switch($a_name)
474  {
475  case "Role":
476  $this->current_role_id = $a_attribs["Id"];
477  if ($internal_id = ilUtil::__extractId($this->current_role_id, IL_INST_ID))
478  {
479  $this->current_role_id = $internal_id;
480  }
481  $this->current_role_type = $a_attribs["Type"];
482  $this->current_role_action = (is_null($a_attribs["Action"])) ? "Assign" : $a_attribs["Action"];
483  break;
484 
485  case "PersonalPicture":
486  $this->personalPicture = array(
487  "encoding" => $a_attribs["encoding"],
488  "imagetype" => $a_attribs["imagetype"],
489  "content" => ""
490  );
491  break;
492 
493  case "Look":
494  $this->skin = $a_attribs["Skin"];
495  $this->style = $a_attribs["Style"];
496  break;
497 
498  case "User":
499  $this->acc_mail->reset();
500  $this->prefs = array();
501  $this->currentPrefKey = null;
502  $this->auth_mode_set = false;
503  $this->approve_date_set = false;
504  $this->time_limit_set = false;
505  $this->time_limit_owner_set = false;
506  $this->updateLookAndSkin = false;
507  $this->skin = "";
508  $this->style = "";
509  $this->personalPicture = null;
510  $this->userCount++;
511  $this->userObj = new ilObjUser();
512 
513  // user defined fields
514  $this->udf_data = array();
515 
516  // if we have an object id, store it
517  $this->user_id = -1;
518  if (!is_null($a_attribs["Id"]) && $this->getUserMappingMode() == IL_USER_MAPPING_ID)
519  {
520  if (is_numeric($a_attribs["Id"]))
521  {
522  $this->user_id = $a_attribs["Id"];
523  }
524  elseif ($id = ilUtil::__extractId ($a_attribs["Id"], IL_INST_ID))
525  {
526  $this->user_id = $id;
527  }
528  }
529 
530  $this->userObj->setPref("skin",
531  $ilias->ini->readVariable("layout","skin"));
532  $this->userObj->setPref("style",
533  $ilias->ini->readVariable("layout","style"));
534 
535  $this->userObj->setLanguage($a_attribs["Language"]);
536  $this->userObj->setImportId($a_attribs["Id"]);
537  $this->action = (is_null($a_attribs["Action"])) ? "Insert" : $a_attribs["Action"];
538  $this->currPassword = null;
539  $this->currPasswordType = null;
540  $this->currPasswordSalt = null;
541  $this->currActive = null;
542  $this->multi_values = array();
543  break;
544 
545  case 'Password':
546  $this->currPasswordType = $a_attribs['Type'];
547  $this->currPasswordSalt = $a_attribs['Salt'];
548  break;
549  case "AuthMode":
550  if (array_key_exists("type", $a_attribs))
551  {
552  switch ($a_attribs["type"])
553  {
554  case "default":
555  case "local":
556  case "ldap":
557  case "radius":
558  case "shibboleth":
559  case "script":
560  case "cas":
561  case "soap":
562  case "openid":
563  // begin-patch auth_plugin
564  default:
565  $this->auth_mode_set = true;
566  $this->userObj->setAuthMode($a_attribs["type"]);
567  break;
568  /*
569  $this->logFailure($this->userObj->getLogin(),
570  sprintf($lng->txt("usrimport_xml_element_inapplicable"),"AuthMode",$a_attribs["type"]));
571  break;
572  *
573  */
574  }
575  }
576  else
577  {
578  $this->logFailure($this->userObj->getLogin(),
579  sprintf($lng->txt("usrimport_xml_element_inapplicable"),"AuthMode",$a_attribs["type"]));
580  }
581  break;
582 
583  case 'UserDefinedField':
584  $this->tmp_udf_id = $a_attribs['Id'];
585  $this->tmp_udf_name = $a_attribs['Name'];
586  break;
587 
588  case 'AccountInfo':
589  $this->current_messenger_type = strtolower($a_attribs["Type"]);
590  break;
591  case 'GMapInfo':
592  $this->userObj->setLatitude($a_attribs["latitude"]);
593  $this->userObj->setLongitude($a_attribs["longitude"]);
594  $this->userObj->setLocationZoom($a_attribs["zoom"]);
595  break;
596  case 'Pref':
597  $this->currentPrefKey = $a_attribs["key"];
598  break;
599  }
600  }
getUserMappingMode()
read access to user mapping mode
const IL_USER_MAPPING_ID
logFailure($aLogin, $aMessage)
Writes a failure log message to the protocol.
static __extractId($ilias_id, $inst_id)
extract ref id from role title, e.g.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ importEndTag()

ilUserImportParser::importEndTag (   $a_xml_parser,
  $a_name 
)

handler for end of element when in import user mode.

Definition at line 924 of file class.ilUserImportParser.php.

References ilSaxParser\$ilias, $ilSetting, $ilUser, ilSaxParser\$lng, $timestamp, $user_id, ilObjUser\_checkExternalAuthAccount(), ilAuthUtils\_getAuthModeName(), ilUserDefinedFields\_getInstance(), ilObjUser\_lookupExternalAccount(), ilObjUser\_uploadPersonalPicture(), assignToRole(), assignToRoleWithParents(), checkProfileIncomplete(), detachFromRole(), getFolderId(), ilObjUser\getUserIdByLogin(), IL_CAL_DATETIME, IL_CAL_UNIX, IL_FAIL_ON_CONFLICT, IL_IGNORE_ON_CONFLICT, IL_PASSWD_CRYPTED, IL_PASSWD_PLAIN, IL_UPDATE_ON_CONFLICT, ilUserXMLWriter\isPrefExportable(), logFailure(), logSuccess(), logWarning(), saveTempImage(), sendAccountMail(), ilUserDefinedData\set(), and updateMailPreferences().

Referenced by handlerEndTag().

925  {
926  global $ilias, $rbacadmin, $rbacreview, $ilUser, $lng, $ilSetting;
927 
928  switch($a_name)
929  {
930  case "Role":
931  $this->roles[$this->current_role_id]["name"] = $this->cdata;
932  $this->roles[$this->current_role_id]["type"] = $this->current_role_type;
933  $this->roles[$this->current_role_id]["action"] = $this->current_role_action;
934  break;
935 
936  case "PersonalPicture":
937  switch ($this->personalPicture["encoding"])
938  {
939  case "Base64":
940  $this->personalPicture["content"] = base64_decode($this->cdata);
941  break;
942  case "UUEncode":
943  // this only works with PHP >= 5
944  if (version_compare(PHP_VERSION,'5','>='))
945  {
946  $this->personalPicture["content"] = convert_uudecode($this->cdata);
947  }
948  break;
949  }
950  break;
951 
952  case "User":
953  $this->userObj->setFullname();
954  // Fetch the user_id from the database, if we didn't have it in xml file
955  // fetch as well, if we are trying to insert -> recognize duplicates!
956  if ($this->user_id == -1 || $this->action=="Insert")
957  $user_id = ilObjUser::getUserIdByLogin($this->userObj->getLogin());
958  else
960 
961  //echo $user_id.":".$this->userObj->getLogin();
962 
963  // Handle conflicts
964  switch ($this->conflict_rule)
965  {
966  case IL_FAIL_ON_CONFLICT :
967  // do not change action
968  break;
969  case IL_UPDATE_ON_CONFLICT :
970  switch ($this->action)
971  {
972  case "Insert" :
973  if ($user_id)
974  {
975  $this->logWarning($this->userObj->getLogin(),sprintf($lng->txt("usrimport_action_replaced"),"Insert","Update"));
976  $this->action = "Update";
977  }
978  break;
979  case "Update" :
980  if (! $user_id)
981  {
982  $this->logWarning($this->userObj->getLogin(),sprintf($lng->txt("usrimport_action_replaced"),"Update","Insert"));
983  $this->action = "Insert";
984  }
985  break;
986  case "Delete" :
987  if (! $user_id)
988  {
989  $this->logWarning($this->userObj->getLogin(),sprintf($lng->txt("usrimport_action_ignored"),"Delete"));
990  $this->action = "Ignore";
991  }
992  break;
993  }
994  break;
995  case IL_IGNORE_ON_CONFLICT :
996  switch ($this->action)
997  {
998  case "Insert" :
999  if ($user_id)
1000  {
1001  $this->logWarning($this->userObj->getLogin(),sprintf($lng->txt("usrimport_action_ignored"),"Insert"));
1002  $this->action = "Ignore";
1003  }
1004  break;
1005  case "Update" :
1006  if (! $user_id)
1007  {
1008  $this->logWarning($this->userObj->getLogin(),sprintf($lng->txt("usrimport_action_ignored"),"Update"));
1009  $this->action = "Ignore";
1010  }
1011  break;
1012  case "Delete" :
1013  if (! $user_id)
1014  {
1015  $this->logWarning($this->userObj->getLogin(),sprintf($lng->txt("usrimport_action_ignored"),"Delete"));
1016  $this->action = "Ignore";
1017  }
1018  break;
1019  }
1020  break;
1021  }
1022 
1023  // check external account conflict (if external account is already used)
1024  // note: we cannot apply conflict rules in the same manner as to logins here
1025  // so we ignore records with already existing external accounts.
1026  //echo $this->userObj->getAuthMode().'h';
1027  $am = ($this->userObj->getAuthMode() == "default" || $this->userObj->getAuthMode() == "")
1028  ? ilAuthUtils::_getAuthModeName($ilSetting->get('auth_mode'))
1029  : $this->userObj->getAuthMode();
1030  $loginForExternalAccount = ($this->userObj->getExternalAccount() == "")
1031  ? ""
1032  : ilObjUser::_checkExternalAuthAccount($am, $this->userObj->getExternalAccount());
1033  switch ($this->action)
1034  {
1035  case "Insert" :
1036  if ($loginForExternalAccount != "")
1037  {
1038  $this->logWarning($this->userObj->getLogin(), $lng->txt("usrimport_no_insert_ext_account_exists")." (".$this->userObj->getExternalAccount().")");
1039  $this->action = "Ignore";
1040  }
1041  break;
1042 
1043  case "Update" :
1044  // this variable describes the ILIAS login which belongs to the given external account!!!
1045  // it is NOT nescessarily the ILIAS login of the current user record !!
1046  // so if we found an ILIAS login according to the authentication method
1047  // check if the ILIAS login belongs to the current user record, otherwise somebody else is using it!
1048  if ($loginForExternalAccount != "")
1049  {
1050  // check if we changed the value!
1051  $externalAccountHasChanged = $this->userObj->getExternalAccount() != ilObjUser::_lookupExternalAccount($this->user_id);
1052  // if it has changed and the external login
1053  if ($externalAccountHasChanged && trim($loginForExternalAccount) != trim($this->userObj->getLogin()))
1054  {
1055  $this->logWarning($this->userObj->getLogin(), $lng->txt("usrimport_no_update_ext_account_exists")." (".$this->userObj->getExternalAccount().")");
1056  $this->action = "Ignore";
1057  }
1058  }
1059  break;
1060  }
1061 
1062  if(sizeof($this->multi_values))
1063  {
1064  if(isset($this->multi_values["GeneralInterest"]))
1065  {
1066  $this->userObj->setGeneralInterests($this->multi_values["GeneralInterest"]);
1067  }
1068  if(isset($this->multi_values["OfferingHelp"]))
1069  {
1070  $this->userObj->setOfferingHelp($this->multi_values["OfferingHelp"]);
1071  }
1072  if(isset($this->multi_values["LookingForHelp"]))
1073  {
1074  $this->userObj->setLookingForHelp($this->multi_values["LookingForHelp"]);
1075  }
1076  }
1077 
1078  // Perform the action
1079  switch ($this->action)
1080  {
1081  case "Insert" :
1082  if ($user_id)
1083  {
1084  $this->logFailure($this->userObj->getLogin(),$lng->txt("usrimport_cant_insert"));
1085  }
1086  else
1087  {
1088 
1089  if(!strlen($this->currPassword) == 0)
1090  {
1091  switch($this->currPasswordType)
1092  {
1093  case "BCRYPT":
1094  if(!strlen($this->currPasswordSalt))
1095  {
1096  $this->logFailure($this->userObj->getLogin(), $lng->txt("usrimport_xml_pw_bcrypt_missing_salt"));
1097  }
1098  $this->userObj->setPasswd($this->currPassword, IL_PASSWD_CRYPTED);
1099  $this->userObj->setPasswordEncodingType('bcrypt');
1100  $this->userObj->setPasswordSalt($this->currPasswordSalt);
1101  break;
1102 
1103  case "PLAIN":
1104  $this->userObj->setPasswd($this->currPassword, IL_PASSWD_PLAIN);
1105  $this->acc_mail->setUserPassword($this->currPassword);
1106  break;
1107 
1108  }
1109  }
1110  else
1111  {
1112  // this does the trick for empty passwords
1113  // since a MD5 string has always 32 characters,
1114  // no hashed password combination will ever equal to
1115  // an empty string
1116  $this->userObj->setPasswd("", IL_PASSWD_CRYPTED);
1117 
1118  }
1119 
1120  $this->userObj->setTitle($this->userObj->getFullname());
1121  $this->userObj->setDescription($this->userObj->getEmail());
1122 
1123  if(!$this->time_limit_owner_set)
1124  {
1125  $this->userObj->setTimeLimitOwner($this->getFolderId());
1126  }
1127 
1128  // default time limit settings
1129  if(!$this->time_limit_set)
1130  {
1131  $this->userObj->setTimeLimitUnlimited(1);
1132  $this->userObj->setTimeLimitMessage(0);
1133 
1134  if (! $this->approve_date_set)
1135  {
1136  $this->userObj->setApproveDate(date("Y-m-d H:i:s"));
1137  }
1138  }
1139 
1140 
1141  $this->userObj->setActive($this->currActive == 'true' || is_null($this->currActive));
1142 
1143  // Finally before saving new user.
1144  // Check if profile is incomplete
1145 
1146  // #8759
1147  if(count($this->udf_data))
1148  {
1149  $this->userObj->setUserDefinedData($this->udf_data);
1150  }
1151 
1152  $this->userObj->setProfileIncomplete($this->checkProfileIncomplete($this->userObj));
1153  $this->userObj->create();
1154 
1155  //insert user data in table user_data
1156  $this->userObj->saveAsNew(false);
1157 
1158  // Set default prefs
1159  $this->userObj->setPref('hits_per_page',$ilSetting->get('hits_per_page',30));
1160  $this->userObj->setPref('show_users_online',$ilSetting->get('show_users_online','y'));
1161 
1162  if (count ($this->prefs))
1163  {
1164  foreach ($this->prefs as $key => $value)
1165  {
1166  if ($key != "mail_incoming_type" &&
1167  $key != "mail_signature" &&
1168  $key != "mail_linebreak"
1169  )
1170  {
1171  $this->userObj->setPref($key, $value);
1172  }
1173  }
1174  }
1175 
1176  $this->userObj->writePrefs();
1177 
1178  // update mail preferences, to be extended
1179  $this->updateMailPreferences($this->userObj->getId());
1180 
1181  if (is_array($this->personalPicture))
1182  {
1183  if (strlen($this->personalPicture["content"]))
1184  {
1185  $extension = "jpg";
1186  if (preg_match("/.*(png|jpg|gif|jpeg)$/", $this->personalPicture["imagetype"], $matches))
1187  {
1188  $extension = $matches[1];
1189  }
1190  $tmp_name = $this->saveTempImage($this->personalPicture["content"], ".$extension");
1191  if (strlen($tmp_name))
1192  {
1193  ilObjUser::_uploadPersonalPicture($tmp_name, $this->userObj->getId());
1194  unlink($tmp_name);
1195  }
1196  }
1197  }
1198 
1199  //set role entries
1200  foreach($this->roles as $role_id => $role)
1201  {
1202  if ($this->role_assign[$role_id])
1203  {
1204  $this->assignToRole($this->userObj, $this->role_assign[$role_id]);
1205  }
1206  }
1207 
1208  if(count($this->udf_data))
1209  {
1210  include_once './Services/User/classes/class.ilUserDefinedData.php';
1211  $udd = new ilUserDefinedData($this->userObj->getId());
1212  foreach($this->udf_data as $field => $value)
1213  {
1214  $udd->set("f_".$field,$value);
1215  }
1216  $udd->update();
1217  }
1218 
1219  $this->sendAccountMail();
1220  $this->logSuccess($this->userObj->getLogin(),$this->userObj->getId(), "Insert");
1221  // reset account mail object
1222  $this->acc_mail->reset();
1223  }
1224  break;
1225 
1226  case "Update" :
1227  if (! $user_id)
1228  {
1229  $this->logFailure($this->userObj->getLogin(),$lng->txt("usrimport_cant_update"));
1230  }
1231  else
1232  {
1233  $updateUser = new ilObjUser($user_id);
1234  $updateUser->read();
1235  $updateUser->readPrefs();
1236  if ($this->currPassword != null)
1237  {
1238  switch ($this->currPasswordType)
1239  {
1240  case "BCRYPT":
1241  if(!strlen($this->currPasswordSalt))
1242  {
1243  $this->logFailure($this->userObj->getLogin(), $lng->txt("usrimport_xml_pw_bcrypt_missing_salt"));
1244  }
1245  $updateUser->setPasswd($this->currPassword, IL_PASSWD_CRYPTED);
1246  $updateUser->setPasswordEncodingType('bcrypt');
1247  $updateUser->setPasswordSalt($this->currPasswordSalt);
1248  break;
1249 
1250  case "PLAIN":
1251  $updateUser->setPasswd($this->currPassword, IL_PASSWD_PLAIN);
1252  $this->acc_mail->setUserPassword($this->currPassword);
1253  break;
1254  }
1255  }
1256  if (! is_null($this->userObj->getFirstname())) $updateUser->setFirstname($this->userObj->getFirstname());
1257  if (! is_null($this->userObj->getLastname())) $updateUser->setLastname($this->userObj->getLastname());
1258  if (! is_null($this->userObj->getUTitle())) $updateUser->setUTitle($this->userObj->getUTitle());
1259  if (! is_null($this->userObj->getGender())) $updateUser->setGender($this->userObj->getGender());
1260  if (! is_null($this->userObj->getEmail())) $updateUser->setEmail($this->userObj->getEmail());
1261  if (! is_null($this->userObj->getBirthday())) $updateUser->setBirthday($this->userObj->getBirthday());
1262  if (! is_null($this->userObj->getInstitution())) $updateUser->setInstitution($this->userObj->getInstitution());
1263  if (! is_null($this->userObj->getStreet())) $updateUser->setStreet($this->userObj->getStreet());
1264  if (! is_null($this->userObj->getCity())) $updateUser->setCity($this->userObj->getCity());
1265  if (! is_null($this->userObj->getZipCode())) $updateUser->setZipCode($this->userObj->getZipCode());
1266  if (! is_null($this->userObj->getCountry())) $updateUser->setCountry($this->userObj->getCountry());
1267  if (! is_null($this->userObj->getPhoneOffice())) $updateUser->setPhoneOffice($this->userObj->getPhoneOffice());
1268  if (! is_null($this->userObj->getPhoneHome())) $updateUser->setPhoneHome($this->userObj->getPhoneHome());
1269  if (! is_null($this->userObj->getPhoneMobile())) $updateUser->setPhoneMobile($this->userObj->getPhoneMobile());
1270  if (! is_null($this->userObj->getFax())) $updateUser->setFax($this->userObj->getFax());
1271  if (! is_null($this->userObj->getHobby())) $updateUser->setHobby($this->userObj->getHobby());
1272  if (! is_null($this->userObj->getGeneralInterests())) $updateUser->setGeneralInterests($this->userObj->getGeneralInterests());
1273  if (! is_null($this->userObj->getOfferingHelp())) $updateUser->setOfferingHelp($this->userObj->getOfferingHelp());
1274  if (! is_null($this->userObj->getLookingForHelp())) $updateUser->setLookingForHelp($this->userObj->getLookingForHelp());
1275  if (! is_null($this->userObj->getComment())) $updateUser->setComment($this->userObj->getComment());
1276  if (! is_null($this->userObj->getDepartment())) $updateUser->setDepartment($this->userObj->getDepartment());
1277  if (! is_null($this->userObj->getMatriculation())) $updateUser->setMatriculation($this->userObj->getMatriculation());
1278  if (! is_null($this->currActive)) $updateUser->setActive($this->currActive == "true", is_object($ilUser) ? $ilUser->getId() : 0);
1279  if (! is_null($this->userObj->getClientIP())) $updateUser->setClientIP($this->userObj->getClientIP());
1280  if (! is_null($this->userObj->getTimeLimitUnlimited())) $updateUser->setTimeLimitUnlimited($this->userObj->getTimeLimitUnlimited());
1281  if (! is_null($this->userObj->getTimeLimitFrom())) $updateUser->setTimeLimitFrom($this->userObj->getTimeLimitFrom());
1282  if (! is_null($this->userObj->getTimeLimitUntil())) $updateUser->setTimeLimitUntil($this->userObj->getTimeLimitUntil());
1283  if (! is_null($this->userObj->getTimeLimitMessage())) $updateUser->setTimeLimitMessage($this->userObj->getTimeLimitMessage());
1284  if (! is_null($this->userObj->getApproveDate())) $updateUser->setApproveDate($this->userObj->getApproveDate());
1285  if (! is_null($this->userObj->getAgreeDate())) $updateUser->setAgreeDate($this->userObj->getAgreeDate());
1286  if (! is_null($this->userObj->getLanguage())) $updateUser->setLanguage($this->userObj->getLanguage());
1287  if (! is_null($this->userObj->getExternalAccount())) $updateUser->setExternalAccount($this->userObj->getExternalAccount());
1288 
1289  // Fixed: if auth_mode is not set, it was always overwritten with auth_default
1290  #if (! is_null($this->userObj->getAuthMode())) $updateUser->setAuthMode($this->userObj->getAuthMode());
1291  if($this->auth_mode_set)
1292  $updateUser->setAuthMode($this->userObj->getAuthMode());
1293 
1294  if (! is_null($this->userObj->getInstantMessengerId("aim"))) $updateUser->setInstantMessengerId("aim", $this->userObj->getInstantMessengerId("aim"));
1295  if (! is_null($this->userObj->getInstantMessengerId("msn"))) $updateUser->setInstantMessengerId("msn", $this->userObj->getInstantMessengerId("msn"));
1296  if (! is_null($this->userObj->getInstantMessengerId("icq"))) $updateUser->setInstantMessengerId("icq", $this->userObj->getInstantMessengerId("icq"));
1297  if (! is_null($this->userObj->getInstantMessengerId("yahoo"))) $updateUser->setInstantMessengerId("yahoo", $this->userObj->getInstantMessengerId("yahoo"));
1298  if (! is_null($this->userObj->getInstantMessengerId("skype"))) $updateUser->setInstantMessengerId("skype", $this->userObj->getInstantMessengerId("skype"));
1299  if (! is_null($this->userObj->getInstantMessengerId("jabber"))) $updateUser->setInstantMessengerId("jabber", $this->userObj->getInstantMessengerId("jabber"));
1300  if (! is_null($this->userObj->getInstantMessengerId("voip"))) $updateUser->setInstantMessengerId("voip", $this->userObj->getInstantMessengerId("voip"));
1301 
1302  // Special handlin since it defaults to 7 (USER_FOLDER_ID)
1303  if($this->time_limit_owner_set)
1304  {
1305  $updateUser->setTimeLimitOwner($this->userObj->getTimeLimitOwner());
1306  }
1307 
1308 
1309  if (count ($this->prefs))
1310  {
1311  foreach ($this->prefs as $key => $value)
1312  {
1313  if ($key != "mail_incoming_type" &&
1314  $key != "mail_signature" &&
1315  $key != "mail_linebreak"
1316  ){
1317  $updateUser->setPref($key, $value);
1318  }
1319  }
1320  }
1321 
1322  // save user preferences (skin and style)
1323  if ($this->updateLookAndSkin)
1324  {
1325  $updateUser->setPref("skin", $this->userObj->getPref("skin"));
1326  $updateUser->setPref("style", $this->userObj->getPref("style"));
1327  }
1328 
1329 
1330  $updateUser->writePrefs();
1331 
1332  // update mail preferences, to be extended
1333  $this->updateMailPreferences($updateUser->getId());
1334 
1335  // #8759
1336  if(count($this->udf_data))
1337  {
1338  $updateUser->setUserDefinedData($this->udf_data);
1339  }
1340 
1341  $updateUser->setProfileIncomplete($this->checkProfileIncomplete($updateUser));
1342 
1343  $updateUser->setTitle($updateUser->getFullname());
1344  $updateUser->setDescription($updateUser->getEmail());
1345  $updateUser->update();
1346 
1347  if(count($this->udf_data))
1348  {
1349  include_once './Services/User/classes/class.ilUserDefinedData.php';
1350  $udd = new ilUserDefinedData($updateUser->getId());
1351  foreach($this->udf_data as $field => $value)
1352  {
1353  $udd->set("f_".$field,$value);
1354  }
1355  $udd->update();
1356  }
1357 
1358  // update login
1359  if (!is_null($this->userObj->getLogin()) && $this->user_id != -1)
1360  {
1361  try
1362  {
1363  $updateUser->updateLogin($this->userObj->getLogin());
1364  }
1365  catch (ilUserException $e)
1366  {
1367  }
1368  }
1369 
1370 
1371  // if language has changed
1372 
1373  if (is_array($this->personalPicture))
1374  {
1375  if (strlen($this->personalPicture["content"]))
1376  {
1377  $extension = "jpg";
1378  if (preg_match("/.*(png|jpg|gif|jpeg)$/", $this->personalPicture["imagetype"], $matches))
1379  {
1380  $extension = $matches[1];
1381  }
1382  $tmp_name = $this->saveTempImage($this->personalPicture["content"], ".$extension");
1383  if (strlen($tmp_name))
1384  {
1385  ilObjUser::_uploadPersonalPicture($tmp_name, $this->userObj->getId());
1386  unlink($tmp_name);
1387  }
1388  }
1389  }
1390 
1391 
1392  //update role entries
1393  //-------------------
1394  foreach ($this->roles as $role_id => $role)
1395  {
1396  if ($this->role_assign[$role_id])
1397  {
1398  switch ($role["action"])
1399  {
1400  case "Assign" :
1401  $this->assignToRole($updateUser, $this->role_assign[$role_id]);
1402  break;
1403  case "AssignWithParents" :
1404  $this->assignToRoleWithParents($updateUser, $this->role_assign[$role_id]);
1405  break;
1406  case "Detach" :
1407  $this->detachFromRole($updateUser, $this->role_assign[$role_id]);
1408  break;
1409  }
1410  }
1411  }
1412  $this->logSuccess($updateUser->getLogin(), $user_id, "Update");
1413  }
1414  break;
1415  case "Delete" :
1416  if (! $user_id)
1417  {
1418  $this->logFailure($this->userObj->getLogin(),$lng->txt("usrimport_cant_delete"));
1419  }
1420  else
1421  {
1422  $deleteUser = new ilObjUser($user_id);
1423  $deleteUser->delete();
1424 
1425  $this->logSuccess($this->userObj->getLogin(),$user_id, "Delete");
1426  }
1427  break;
1428  }
1429 
1430  // init role array for next user
1431  $this->roles = array();
1432  break;
1433 
1434  case "Login":
1435  $this->userObj->setLogin($this->cdata);
1436  break;
1437 
1438  case "Password":
1439  $this->currPassword = $this->cdata;
1440  break;
1441 
1442  case "Firstname":
1443  $this->userObj->setFirstname($this->cdata);
1444  break;
1445 
1446  case "Lastname":
1447  $this->userObj->setLastname($this->cdata);
1448  break;
1449 
1450  case "Title":
1451  $this->userObj->setUTitle($this->cdata);
1452  break;
1453 
1454  case "Gender":
1455  $this->userObj->setGender($this->cdata);
1456  break;
1457 
1458  case "Email":
1459  $this->userObj->setEmail($this->cdata);
1460  break;
1461 
1462  case "Birthday":
1463  $timestamp = strtotime($this->cdata);
1464  if ($timestamp !== false)
1465  {
1466  $this->userObj->setBirthday($this->cdata);
1467  }
1468  break;
1469  case "Institution":
1470  $this->userObj->setInstitution($this->cdata);
1471  break;
1472 
1473  case "Street":
1474  $this->userObj->setStreet($this->cdata);
1475  break;
1476 
1477  case "City":
1478  $this->userObj->setCity($this->cdata);
1479  break;
1480 
1481  case "PostalCode":
1482  $this->userObj->setZipCode($this->cdata);
1483  break;
1484 
1485  case "Country":
1486  $this->userObj->setCountry($this->cdata);
1487  break;
1488 
1489  case "PhoneOffice":
1490  $this->userObj->setPhoneOffice($this->cdata);
1491  break;
1492 
1493  case "PhoneHome":
1494  $this->userObj->setPhoneHome($this->cdata);
1495  break;
1496 
1497  case "PhoneMobile":
1498  $this->userObj->setPhoneMobile($this->cdata);
1499  break;
1500 
1501  case "Fax":
1502  $this->userObj->setFax($this->cdata);
1503  break;
1504 
1505  case "Hobby":
1506  $this->userObj->setHobby($this->cdata);
1507  break;
1508 
1509  case "GeneralInterest":
1510  case "OfferingHelp":
1511  case "LookingForHelp":
1512  $this->multi_values[$a_name][] = $this->cdata;
1513  break;
1514 
1515  case "Comment":
1516  $this->userObj->setComment($this->cdata);
1517  break;
1518 
1519  case "Department":
1520  $this->userObj->setDepartment($this->cdata);
1521  break;
1522 
1523  case "Matriculation":
1524  $this->userObj->setMatriculation($this->cdata);
1525  break;
1526 
1527  case "Active":
1528  $this->currActive = $this->cdata;
1529  break;
1530 
1531  case "ClientIP":
1532  $this->userObj->setClientIP($this->cdata);
1533  break;
1534 
1535  case "TimeLimitOwner":
1536  $this->time_limit_owner_set = true;
1537  $this->userObj->setTimeLimitOwner($this->cdata);
1538  break;
1539 
1540  case "TimeLimitUnlimited":
1541  $this->time_limit_set = true;
1542  $this->userObj->setTimeLimitUnlimited($this->cdata);
1543  break;
1544 
1545  case "TimeLimitFrom":
1546  if (is_numeric($this->cdata))
1547  {
1548  // Treat cdata as a unix timestamp
1549  $this->userObj->setTimeLimitFrom($this->cdata);
1550  }
1551  else
1552  {
1553  // Try to convert cdata into unix timestamp, or ignore it
1554  $timestamp = strtotime($this->cdata);
1555  if ($timestamp !== false && trim($this->cdata) != "0000-00-00 00:00:00")
1556  {
1557  $this->userObj->setTimeLimitFrom($timestamp);
1558  }
1559  elseif ($this->cdata == "0000-00-00 00:00:00")
1560  {
1561  $this->userObj->setTimeLimitFrom(null);
1562  }
1563 
1564  }
1565  break;
1566 
1567  case "TimeLimitUntil":
1568  if (is_numeric($this->cdata))
1569  {
1570  // Treat cdata as a unix timestamp
1571  $this->userObj->setTimeLimitUntil($this->cdata);
1572  }
1573  else
1574  {
1575  // Try to convert cdata into unix timestamp, or ignore it
1576  $timestamp = strtotime($this->cdata);
1577  if ($timestamp !== false && trim($this->cdata) != "0000-00-00 00:00:00")
1578  {
1579  $this->userObj->setTimeLimitUntil($timestamp);
1580  }
1581  elseif ($this->cdata == "0000-00-00 00:00:00")
1582  {
1583  $this->userObj->setTimeLimitUntil(null);
1584  }
1585  }
1586  break;
1587 
1588  case "TimeLimitMessage":
1589  $this->userObj->setTimeLimitMessage($this->cdata);
1590  break;
1591 
1592  case "ApproveDate":
1593  $this->approve_date_set = true;
1594  if (is_numeric($this->cdata))
1595  {
1596  // Treat cdata as a unix timestamp
1597  $tmp_date = new ilDateTime($this->cdata,IL_CAL_UNIX);
1598  $this->userObj->setApproveDate($tmp_date->get(IL_CAL_DATETIME));
1599  }
1600  else
1601  {
1602  // Try to convert cdata into unix timestamp, or ignore it
1603  $timestamp = strtotime($this->cdata);
1604  if ($timestamp !== false && trim($this->cdata) != "0000-00-00 00:00:00")
1605  {
1606  $tmp_date = new ilDateTime($timestamp,IL_CAL_UNIX);
1607  $this->userObj->setApproveDate($tmp_date->get(IL_CAL_DATETIME));
1608  }
1609  elseif ($this->cdata == "0000-00-00 00:00:00")
1610  {
1611  $this->userObj->setApproveDate(null);
1612  }
1613  }
1614  break;
1615 
1616  case "AgreeDate":
1617  if (is_numeric($this->cdata))
1618  {
1619  // Treat cdata as a unix timestamp
1620  $tmp_date = new ilDateTime($this->cdata,IL_CAL_UNIX);
1621  $this->userObj->setAgreeDate($tmp_date->get(IL_CAL_DATETIME));
1622  }
1623  else
1624  {
1625  // Try to convert cdata into unix timestamp, or ignore it
1626  $timestamp = strtotime($this->cdata);
1627  if ($timestamp !== false && trim($this->cdata) != "0000-00-00 00:00:00")
1628  {
1629  $tmp_date = new ilDateTime($timestamp,IL_CAL_UNIX);
1630  $this->userObj->setAgreeDate($tmp_date->get(IL_CAL_DATETIME));
1631  }
1632  elseif ($this->cdata == "0000-00-00 00:00:00")
1633  {
1634  $this->userObj->setAgreeDate(null);
1635  }
1636  }
1637  break;
1638 
1639  case "ExternalAccount":
1640  $this->userObj->setExternalAccount($this->cdata);
1641  break;
1642 
1643  case "Look":
1644  $this->updateLookAndSkin = false;
1645  if (!$this->hideSkin)
1646  {
1647  // TODO: what to do with disabled skins? is it possible to change the skin via import?
1648  if ((strlen($this->skin) > 0) && (strlen($this->style) > 0))
1649  {
1650  if (is_array($this->userStyles))
1651  {
1652  if (in_array($this->skin . ":" . $this->style, $this->userStyles))
1653  {
1654  $this->userObj->setPref("skin", $this->skin);
1655  $this->userObj->setPref("style", $this->style);
1656  $this->updateLookAndSkin = true;
1657  }
1658  }
1659  }
1660  }
1661  break;
1662 
1663  case 'UserDefinedField':
1664  include_once './Services/User/classes/class.ilUserDefinedFields.php';
1666  if($field_id = $udf->fetchFieldIdFromImportId($this->tmp_udf_id))
1667  {
1668  $this->udf_data[$field_id] = $this->cdata;
1669  }
1670  elseif($field_id = $udf->fetchFieldIdFromName($this->tmp_udf_name))
1671  {
1672  $this->udf_data[$field_id] = $this->cdata;
1673  }
1674  break;
1675  case 'AccountInfo':
1676  if ($this->current_messenger_type =="delicious")
1677  {
1678  $this->userObj->setDelicious($this->cdata);
1679  }
1680  elseif ($this->current_messenger_type =="external")
1681  {
1682  $this->userObj->setExternalAccount($this->cdata);
1683  }
1684  else
1685  {
1686  $this->userObj->setInstantMessengerId($this->current_messenger_type, $this->cdata);
1687  }
1688  break;
1689  case 'Pref':
1690  if ($this->currentPrefKey != null && strlen(trim($this->cdata)) > 0
1691  && ilUserXMLWriter::isPrefExportable($this->currentPrefKey))
1692  $this->prefs[$this->currentPrefKey] = trim($this->cdata);
1693  $this->currentPrefKey = null;
1694  break;
1695  }
1696  }
Class for user related exception handling in ILIAS.
const IL_PASSWD_PLAIN
sendAccountMail()
send account mail
const IL_CAL_DATETIME
static _getInstance()
Get instance.
Class ilUserDefinedData.
_lookupExternalAccount($a_user_id)
lookup external account for login and authmethod
const IL_PASSWD_CRYPTED
const IL_FAIL_ON_CONFLICT
assignToRole($a_user_obj, $a_role_id)
Assigns a user to a role.
checkProfileIncomplete($user_obj)
Check if profile is incomplete Will set the usr_data field profile_incomplete if any required field i...
static isPrefExportable($key)
returns wether a key from db is exportable or not
const IL_CAL_UNIX
static _getAuthModeName($a_auth_key)
logWarning($aLogin, $aMessage)
Writes a warning log message to the protocol.
assignToRoleWithParents($a_user_obj, $a_role_id)
Assigns a user to a role and to all parent roles.
_uploadPersonalPicture($tmp_file, $obj_id)
Create a personal picture image file from a temporary image file.
getUserIdByLogin($a_login)
Date and time handling
logFailure($aLogin, $aMessage)
Writes a failure log message to the protocol.
foreach($mandatory_scripts as $file) $timestamp
Definition: buildRTE.php:81
logSuccess($aLogin, $userid, $action)
Writes a success log message to the protocol.
saveTempImage($image_data, $filename)
Saves binary image data to a temporary image file and returns the name of the image file on success...
global $ilUser
Definition: imgupload.php:15
set($a_field, $a_value)
global $ilSetting
Definition: privfeed.php:40
detachFromRole($a_user_obj, $a_role_id)
Detachs a user from a role.
static _checkExternalAuthAccount($a_auth, $a_account)
check whether external account and authentication method matches with a user
const IL_UPDATE_ON_CONFLICT
const IL_IGNORE_ON_CONFLICT
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isFieldRequired()

ilUserImportParser::isFieldRequired (   $fieldname)
protected

determine if a field $fieldname is to a required field (global setting)

Parameters
$fieldnamestring value of fieldname, e.g. gender
Returns
true, if field of required fields contains fieldname as key, false otherwise.

Definition at line 2357 of file class.ilUserImportParser.php.

References readRequiredFields().

Referenced by verifyEndTag().

2358  {
2359  $requiredFields = $this->readRequiredFields();
2360  $fieldname = strtolower(trim($fieldname));
2361  return array_key_exists($fieldname, $requiredFields);
2362  }
readRequiredFields()
read required fields
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isSendMail()

ilUserImportParser::isSendMail ( )

read access to property send mail

Returns
boolean

Definition at line 2286 of file class.ilUserImportParser.php.

References $send_mail.

Referenced by sendAccountMail().

2286  {
2287  return $this->send_mail;
2288  }
+ Here is the caller graph for this function:

◆ isSuccess()

ilUserImportParser::isSuccess ( )

Returns true, if the import was successful.

Definition at line 2192 of file class.ilUserImportParser.php.

References IL_IMPORT_SUCCESS.

2193  {
2194  return $this->error_level == IL_IMPORT_SUCCESS;
2195  }
const IL_IMPORT_SUCCESS

◆ logFailure()

ilUserImportParser::logFailure (   $aLogin,
  $aMessage 
)

Writes a failure log message to the protocol.

Parameters
stringlogin
stringmessage

Definition at line 2118 of file class.ilUserImportParser.php.

References IL_IMPORT_FAILURE.

Referenced by importBeginTag(), importEndTag(), verifyBeginTag(), verifyEndTag(), and verifyPref().

2119  {
2120  if (! array_key_exists($aLogin, $this->protocol))
2121  {
2122  $this->protocol[$aLogin] = array();
2123  }
2124  if ($aMessage)
2125  {
2126  $this->protocol[$aLogin][] = $aMessage;
2127  }
2128  $this->error_level = IL_IMPORT_FAILURE;
2129  }
const IL_IMPORT_FAILURE
+ Here is the caller graph for this function:

◆ logSuccess()

ilUserImportParser::logSuccess (   $aLogin,
  $userid,
  $action 
)

Writes a success log message to the protocol.

Parameters
stringlogin
stringuserid
stringaction

Definition at line 2138 of file class.ilUserImportParser.php.

Referenced by importEndTag().

2139  {
2140  $this->user_mapping[$userid] = array("login" => $aLogin, "action" => $action, "message" => "successful");
2141  }
$action
The Action attribute determines what to do for the current User element.
+ Here is the caller graph for this function:

◆ logWarning()

ilUserImportParser::logWarning (   $aLogin,
  $aMessage 
)

Writes a warning log message to the protocol.

Parameters
stringlogin
stringmessage

Definition at line 2097 of file class.ilUserImportParser.php.

References IL_IMPORT_SUCCESS, and IL_IMPORT_WARNING.

Referenced by importEndTag(), and verifyEndTag().

2098  {
2099  if (! array_key_exists($aLogin, $this->protocol))
2100  {
2101  $this->protocol[$aLogin] = array();
2102  }
2103  if ($aMessage)
2104  {
2105  $this->protocol[$aLogin][] = $aMessage;
2106  }
2107  if ($this->error_level == IL_IMPORT_SUCCESS)
2108  {
2109  $this->error_level = IL_IMPORT_WARNING;
2110  }
2111  }
const IL_IMPORT_WARNING
const IL_IMPORT_SUCCESS
+ Here is the caller graph for this function:

◆ readAccountMailFromCache()

ilUserImportParser::readAccountMailFromCache (   $lang_key)
private
Parameters
$lang_key
Returns
mixed

Definition at line 2243 of file class.ilUserImportParser.php.

References $GLOBALS, and ilObjUserFolder\_lookupNewAccountMail().

Referenced by sendAccountMail().

2244  {
2245  if(!isset(self::$account_mail_cache[$lang_key]))
2246  {
2247  $default_lang_key = $GLOBALS["lng"]->getDefaultLanguage();
2248 
2249  // try individual account mail in user administration
2250  include_once './Services/User/classes/class.ilObjUserFolder.php';
2251 
2252  $amail = ilObjUserFolder::_lookupNewAccountMail($lang_key);
2253 
2254  if (trim($amail["body"]) != "" && trim($amail["subject"]) != "")
2255  {
2256  self::$account_mail_cache[$lang_key] = $amail;
2257  }
2258  else
2259  {
2260  $lang_key = $default_lang_key;
2261  }
2262 
2263  if(!isset(self::$account_mail_cache[$default_lang_key]))
2264  {
2265  $amail = ilObjUserFolder::_lookupNewAccountMail($default_lang_key);
2266  self::$account_mail_cache[$default_lang_key] = $amail;
2267  }
2268  }
2269  return self::$account_mail_cache[$lang_key];
2270  }
$GLOBALS['ct_recipient']
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readRequiredFields()

ilUserImportParser::readRequiredFields ( )
private

read required fields

private

Definition at line 2318 of file class.ilUserImportParser.php.

References $ilSetting.

Referenced by isFieldRequired().

2319  {
2320  global $ilSetting;
2321 
2322  if(is_array($this->required_fields))
2323  {
2324  return $this->required_fields;
2325  }
2326  foreach($ilSetting->getAll() as $field => $value)
2327  {
2328  if(substr($field,0,8) == 'require_' and $value == 1)
2329  {
2330  $value = substr($field,8);
2331  $this->required_fields[$value] = $value;
2332  }
2333  }
2334  return $this->required_fields ? $this->required_fields : array();
2335  }
global $ilSetting
Definition: privfeed.php:40
+ Here is the caller graph for this function:

◆ saveTempImage()

ilUserImportParser::saveTempImage (   $image_data,
  $filename 
)

Saves binary image data to a temporary image file and returns the name of the image file on success.

Definition at line 1702 of file class.ilUserImportParser.php.

References $filename, and ilUtil\ilTempnam().

Referenced by importEndTag().

1703  {
1704  $tempname = ilUtil::ilTempnam() . $filename;
1705  $fh = fopen($tempname, "wb");
1706  if ($fh == false)
1707  {
1708  return "";
1709  }
1710  $imagefile = fwrite($fh, $image_data);
1711  fclose($fh);
1712  return $tempname;
1713  }
$filename
Definition: buildRTE.php:89
static ilTempnam()
Create a temporary file in an ILIAS writable directory.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sendAccountMail()

ilUserImportParser::sendAccountMail ( )

send account mail

Definition at line 2218 of file class.ilUserImportParser.php.

References $_POST, $path, isSendMail(), readAccountMailFromCache(), and USER_FOLDER_ID.

Referenced by importEndTag().

2219  {
2220  if($_POST["send_mail"] != "" ||
2221  ($this->isSendMail() && $this->userObj->getEmail() != ""))
2222  {
2223  $this->acc_mail->setUser($this->userObj);
2224 
2225  $amail = $this->readAccountMailFromCache($this->userObj->getLanguage());
2226  if($amail["att_file"])
2227  {
2228  include_once "Services/User/classes/class.ilFSStorageUserFolder.php";
2230  $fs->create();
2231  $path = $fs->getAbsolutePath() . "/";
2232 
2233  $this->acc_mail->addAttachment($path . "/" . $amail["lang"], $amail["att_file"]);
2234  }
2235  $this->acc_mail->send();
2236  }
2237  }
$_POST['username']
Definition: cron.php:12
isSendMail()
read access to property send mail
$path
Definition: index.php:22
const USER_FOLDER_ID
Class ilObjUserFolder.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setFolderId()

ilUserImportParser::setFolderId (   $a_folder_id)

assign users to this folder (normally the usr_folder) But if called from local admin => the ref_id of the category public

Definition at line 359 of file class.ilUserImportParser.php.

360  {
361  $this->folder_id = $a_folder_id;
362  }

◆ setHandlers()

ilUserImportParser::setHandlers (   $a_xml_parser)

set event handler should be overwritten by inherited class private

Definition at line 374 of file class.ilUserImportParser.php.

375  {
376  xml_set_object($a_xml_parser,$this);
377  xml_set_element_handler($a_xml_parser,'handlerBeginTag','handlerEndTag');
378  xml_set_character_data_handler($a_xml_parser,'handlerCharacterData');
379  }

◆ setRoleAssignment()

ilUserImportParser::setRoleAssignment (   $a_assign)

set import to local role assignemt

Parameters
arrayrole assignment (key: import id; value: local role id)

Definition at line 394 of file class.ilUserImportParser.php.

395  {
396  $this->role_assign = $a_assign;
397  }

◆ setSendMail()

ilUserImportParser::setSendMail (   $value)

write access to property send mail

Parameters
mixed$value

Definition at line 2277 of file class.ilUserImportParser.php.

2277  {
2278  $this->send_mail = $value ? true: false;
2279  }

◆ setUserMappingMode()

ilUserImportParser::setUserMappingMode (   $value)

write access to user mapping mode

Parameters
int$valuemust be one of IL_USER_MAPPING_ID or IL_USER_MAPPING_LOGIN, die otherwise

Definition at line 2295 of file class.ilUserImportParser.php.

References IL_USER_MAPPING_ID, and IL_USER_MAPPING_LOGIN.

2296  {
2297  if ($value == IL_USER_MAPPING_ID || $value == IL_USER_MAPPING_LOGIN)
2298  $this->mapping_mode = $value;
2299  else die ("wrong argument using methode setUserMappingMethod in ".__FILE__);
2300  }
const IL_USER_MAPPING_LOGIN
const IL_USER_MAPPING_ID

◆ startParsing()

ilUserImportParser::startParsing ( )

start the parser

Definition at line 384 of file class.ilUserImportParser.php.

385  {
386  parent::startParsing();
387  }

◆ updateMailPreferences()

ilUserImportParser::updateMailPreferences (   $usr_id)
private

Definition at line 2443 of file class.ilUserImportParser.php.

Referenced by importEndTag().

2443  {
2444  if (array_key_exists("mail_incoming_type", $this->prefs) ||
2445  array_key_exists("mail_signature", $this->prefs) ||
2446  array_key_exists("mail_linebreak", $this->prefs)
2447  )
2448  {
2449  include_once("Services/Mail/classes/class.ilMailOptions.php");
2450  $mailOptions = new ilMailOptions($usr_id);
2451  $mailOptions->updateOptions(
2452  array_key_exists("mail_signature", $this->prefs) ? $this->prefs["mail_signature"] : $mailOptions->getSignature(),
2453  array_key_exists("mail_linebreak", $this->prefs) ? $this->prefs["mail_linebreak"] : $mailOptions->getLinebreak(),
2454  array_key_exists("mail_incoming_type", $this->prefs) ? $this->prefs["mail_incoming_type"] : $mailOptions->getIncomingType(),
2455  $mailOptions->getCronjobNotification()
2456  );
2457  }
2458  }
Class UserMail this class handles user mails.
+ Here is the caller graph for this function:

◆ verifyBeginTag()

ilUserImportParser::verifyBeginTag (   $a_xml_parser,
  $a_name,
  $a_attribs 
)

handler for begin of element

Definition at line 604 of file class.ilUserImportParser.php.

References $action, ilSaxParser\$lng, ilUtil\__extractId(), getUserMappingMode(), IL_USER_MAPPING_ID, and logFailure().

Referenced by handlerBeginTag().

605  {
606  global $lng;
607 
608  switch($a_name)
609  {
610  case "Role":
611  if (is_null($a_attribs['Id'])
612  || $a_attribs['Id'] == "")
613  {
614  $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_attribute_missing"),"Role","Id"));
615  }
616  $this->current_role_id = $a_attribs["Id"];
617  $this->current_role_type = $a_attribs["Type"];
618  if ($this->current_role_type != 'Global'
619  && $this->current_role_type != 'Local')
620  {
621  $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_attribute_missing"),"Role","Type"));
622  }
623  $this->current_role_action = (is_null($a_attribs["Action"])) ? "Assign" : $a_attribs["Action"];
624  if ($this->current_role_action != "Assign"
625  && $this->current_role_action != "AssignWithParents"
626  && $this->current_role_action != "Detach")
627  {
628  $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_attribute_value_illegal"),"Role","Action",$a_attribs["Action"]));
629  }
630  if ($this->action == "Insert"
631  && $this->current_role_action == "Detach")
632  {
633  $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_attribute_value_inapplicable"),"Role","Action",$this->current_role_action,$this->action));
634  }
635  if ($this->action == "Delete")
636  {
637  $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_inapplicable"),"Role","Delete"));
638  }
639  break;
640 
641  case "User":
642  $this->userCount++;
643  $this->userObj = new ilObjUser();
644  $this->userObj->setLanguage($a_attribs["Language"]);
645  $this->userObj->setImportId($a_attribs["Id"]);
646  $this->currentPrefKey = null;
647  // if we have an object id, store it
648  $this->user_id = -1;
649 
650  if (!is_null($a_attribs["Id"]) && $this->getUserMappingMode() == IL_USER_MAPPING_ID)
651  {
652  if (is_numeric($a_attribs["Id"]))
653  {
654  $this->user_id = $a_attribs["Id"];
655  }
656  elseif ($id = ilUtil::__extractId ($a_attribs["Id"], IL_INST_ID))
657  {
658  $this->user_id = $id;
659  }
660  }
661 
662  $this->action = (is_null($a_attribs["Action"])) ? "Insert" : $a_attribs["Action"];
663  if ($this->action != "Insert"
664  && $this->action != "Update"
665  && $this->action != "Delete")
666  {
667  $this->logFailure($this->userObj->getImportId(), sprintf($lng->txt("usrimport_xml_attribute_value_illegal"),"User","Action",$a_attribs["Action"]));
668  }
669  $this->currPassword = null;
670  $this->currPasswordType = null;
671  $this->currPasswordSalt = null;
672  break;
673 
674  case 'Password':
675  $this->currPasswordType = $a_attribs['Type'];
676  $this->currPasswordSalt = $a_attribs['Salt'];
677  break;
678  case "AuthMode":
679  if (array_key_exists("type", $a_attribs))
680  {
681  switch ($a_attribs["type"])
682  {
683  case "default":
684  case "local":
685  case "ldap":
686  case "radius":
687  case "shibboleth":
688  case "script":
689  case "cas":
690  case "soap":
691  case "openid":
692  // begin-patch auth_plugin
693  default:
694  $this->userObj->setAuthMode($a_attribs["type"]);
695  break;
696  /*
697  default:
698  $this->logFailure($this->userObj->getImportId(), sprintf($lng->txt("usrimport_xml_attribute_value_illegal"),"AuthMode","type",$a_attribs["type"]));
699  break;
700  *
701  */
702  }
703  }
704  else
705  {
706  $this->logFailure($this->userObj->getImportId(), sprintf($lng->txt("usrimport_xml_attribute_value_illegal"),"AuthMode","type",""));
707  }
708  break;
709  case 'Pref':
710  $this->currentPrefKey = $a_attribs["key"];
711  break;
712 
713  }
714  }
getUserMappingMode()
read access to user mapping mode
$action
The Action attribute determines what to do for the current User element.
const IL_USER_MAPPING_ID
logFailure($aLogin, $aMessage)
Writes a failure log message to the protocol.
static __extractId($ilias_id, $inst_id)
extract ref id from role title, e.g.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ verifyEndTag()

ilUserImportParser::verifyEndTag (   $a_xml_parser,
  $a_name 
)

handler for end of element when in verify mode.

Definition at line 1718 of file class.ilUserImportParser.php.

References $currPasswordType, $ilSetting, ilSaxParser\$lng, $user_id, ilObjUser\_checkExternalAuthAccount(), ilAuthUtils\_getAuthModeName(), ilObjUser\_lookupExternalAccount(), ilObjUser\_lookupId(), ilObjUser\_lookupLogin(), ilObjUser\getUserIdByLogin(), IL_FAIL_ON_CONFLICT, IL_PASSWD_CRYPTED, IL_PASSWD_PLAIN, isFieldRequired(), logFailure(), logWarning(), USER_FOLDER_ID, and verifyPref().

Referenced by handlerEndTag().

1719  {
1720  global $lng,$ilAccess,$ilSetting,$ilObjDataCache;
1721 
1722  switch($a_name)
1723  {
1724  case "Role":
1725  $this->roles[$this->current_role_id]["name"] = $this->cdata;
1726  $this->roles[$this->current_role_id]["type"] = $this->current_role_type;
1727  $this->roles[$this->current_role_id]["action"] = $this->current_role_action;
1728  break;
1729 
1730  case "User":
1731  $this->userObj->setFullname();
1732  if ($this->user_id != -1 && ($this->action == "Update" || $this->action == "Delete"))
1733  $user_exists = !is_null(ilObjUser::_lookupLogin($this->user_id));
1734  else
1735  $user_exists = ilObjUser::getUserIdByLogin($this->userObj->getLogin()) != 0;
1736 
1737  if (is_null($this->userObj->getLogin()))
1738  {
1739  $this->logFailure("---",sprintf($lng->txt("usrimport_xml_element_for_action_required"),"Login", "Insert"));
1740  }
1741 
1742  switch ($this->action)
1743  {
1744  case "Insert" :
1745  if ($user_exists and $this->conflict_rule == IL_FAIL_ON_CONFLICT)
1746  {
1747  $this->logWarning($this->userObj->getLogin(),$lng->txt("usrimport_cant_insert"));
1748  }
1749  if (is_null($this->userObj->getGender()) && $this->isFieldRequired("gender"))
1750  {
1751  $this->logFailure($this->userObj->getLogin(),sprintf($lng->txt("usrimport_xml_element_for_action_required"),"Gender", "Insert"));
1752  }
1753  if (is_null($this->userObj->getFirstname()))
1754  {
1755  $this->logFailure($this->userObj->getLogin(),sprintf($lng->txt("usrimport_xml_element_for_action_required"),"Firstname", "Insert"));
1756  }
1757  if (is_null($this->userObj->getLastname()))
1758  {
1759  $this->logFailure($this->userObj->getLogin(),sprintf($lng->txt("usrimport_xml_element_for_action_required"),"Lastname", "Insert"));
1760  }
1761  if (count($this->roles) == 0)
1762  {
1763  $this->logFailure($this->userObj->getLogin(),sprintf($lng->txt("usrimport_xml_element_for_action_required"),"Role", "Insert"));
1764  }
1765  else
1766  {
1767  $has_global_role = false;
1768  foreach ($this->roles as $role)
1769  {
1770  if ($role['type'] == 'Global')
1771  {
1772  $has_global_role = true;
1773  break;
1774  }
1775  }
1776  if (! $has_global_role)
1777  {
1778  $this->logFailure($this->userObj->getLogin(),sprintf($lng->txt("usrimport_global_role_for_action_required"),"Insert"));
1779  }
1780  }
1781  break;
1782  case "Update" :
1783  if(!$user_exists)
1784  {
1785  $this->logWarning($this->userObj->getLogin(),$lng->txt("usrimport_cant_update"));
1786  }
1787  elseif($this->user_id != -1 && !is_null($this->userObj->getLogin()))
1788  // check if someone owns the new login name!
1789  {
1790  $someonesId = ilObjUser::_lookupId($this->userObj->getLogin());
1791 
1792  if (is_numeric($someonesId ) && $someonesId != $this->user_id) {
1793  $this->logFailure($this->userObj->getLogin(), $lng->txt("usrimport_login_is_not_unique"));
1794  }
1795  }
1796  break;
1797  case "Delete" :
1798  if(!$user_exists)
1799  {
1800  $this->logWarning($this->userObj->getLogin(),$lng->txt("usrimport_cant_delete"));
1801  }
1802  break;
1803  }
1804 
1805  // init role array for next user
1806  $this->roles = array();
1807  break;
1808 
1809  case "Login":
1810  if (array_key_exists($this->cdata, $this->logins))
1811  {
1812  $this->logWarning($this->cdata, $lng->txt("usrimport_login_is_not_unique"));
1813  }
1814  else
1815  {
1816  $this->logins[$this->cdata] = $this->cdata;
1817  }
1818  $this->userObj->setLogin($this->cdata);
1819  break;
1820 
1821  case "Password":
1822  switch ($this->currPasswordType)
1823  {
1824  case "BCRYPT":
1825  if(!strlen($this->currPasswordSalt))
1826  {
1827  $this->logFailure($this->userObj->getLogin(), $lng->txt("usrimport_xml_pw_bcrypt_missing_salt"));
1828  }
1829  $this->userObj->setPasswd($this->cdata, IL_PASSWD_CRYPTED);
1830  $this->userObj->setPasswordEncodingType('bcrypt');
1831  $this->userObj->setPasswordSalt($this->currPasswordSalt);
1832  break;
1833 
1834  case "PLAIN":
1835  $this->userObj->setPasswd($this->cdata, IL_PASSWD_PLAIN);
1836  $this->acc_mail->setUserPassword($this->currPassword);
1837  break;
1838 
1839  default :
1840  $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_attribute_value_illegal"),"Type","Password",$this->currPasswordType));
1841  break;
1842  }
1843  break;
1844 
1845  case "Firstname":
1846  $this->userObj->setFirstname($this->cdata);
1847  break;
1848 
1849  case "Lastname":
1850  $this->userObj->setLastname($this->cdata);
1851  break;
1852 
1853  case "Title":
1854  $this->userObj->setUTitle($this->cdata);
1855  break;
1856 
1857  case "Gender":
1858  if ($this->cdata != "m"
1859  && $this->cdata != "f")
1860  {
1861  $this->logFailure(
1862  $this->userObj->getLogin(),
1863  sprintf($lng->txt("usrimport_xml_element_content_illegal"),"Gender",$this->cdata)
1864  );
1865  }
1866  $this->userObj->setGender($this->cdata);
1867  break;
1868 
1869  case "Email":
1870  $this->userObj->setEmail($this->cdata);
1871  break;
1872 
1873  case "Institution":
1874  $this->userObj->setInstitution($this->cdata);
1875  break;
1876 
1877  case "Street":
1878  $this->userObj->setStreet($this->cdata);
1879  break;
1880 
1881  case "City":
1882  $this->userObj->setCity($this->cdata);
1883  break;
1884 
1885  case "PostalCode":
1886  $this->userObj->setZipCode($this->cdata);
1887  break;
1888 
1889  case "Country":
1890  $this->userObj->setCountry($this->cdata);
1891  break;
1892 
1893  case "PhoneOffice":
1894  $this->userObj->setPhoneOffice($this->cdata);
1895  break;
1896 
1897  case "PhoneHome":
1898  $this->userObj->setPhoneHome($this->cdata);
1899  break;
1900 
1901  case "PhoneMobile":
1902  $this->userObj->setPhoneMobile($this->cdata);
1903  break;
1904 
1905  case "Fax":
1906  $this->userObj->setFax($this->cdata);
1907  break;
1908 
1909  case "Hobby":
1910  $this->userObj->setHobby($this->cdata);
1911  break;
1912 
1913  case "GeneralInterest":
1914  case "OfferingHelp":
1915  case "LookingForHelp":
1916  $this->multi_values[$a_name][] = $this->cdata;
1917  break;
1918 
1919  case "Comment":
1920  $this->userObj->setComment($this->cdata);
1921  break;
1922 
1923  case "Department":
1924  $this->userObj->setDepartment($this->cdata);
1925  break;
1926 
1927  case "Matriculation":
1928  $this->userObj->setMatriculation($this->cdata);
1929  break;
1930 
1931  case "ExternalAccount":
1932 //echo "-".$this->userObj->getAuthMode()."-".$this->userObj->getLogin()."-";
1933  $am = ($this->userObj->getAuthMode() == "default" || $this->userObj->getAuthMode() == "")
1934  ? ilAuthUtils::_getAuthModeName($ilSetting->get('auth_mode'))
1935  : $this->userObj->getAuthMode();
1936  $loginForExternalAccount = (trim($this->cdata) == "")
1937  ? ""
1938  : ilObjUser::_checkExternalAuthAccount($am, trim($this->cdata));
1939  switch ($this->action)
1940  {
1941  case "Insert" :
1942  if ($loginForExternalAccount != "")
1943  {
1944  $this->logWarning($this->userObj->getLogin(), $lng->txt("usrimport_no_insert_ext_account_exists")." (".$this->cdata.")");
1945  }
1946  break;
1947 
1948  case "Update" :
1949  if ($loginForExternalAccount != "")
1950  {
1951  $externalAccountHasChanged = trim($this->cdata) != ilObjUser::_lookupExternalAccount($this->user_id);
1952  if ($externalAccountHasChanged && trim($loginForExternalAccount) != trim($this->userObj->getLogin()))
1953  {
1954  $this->logWarning($this->userObj->getLogin(),
1955  $lng->txt("usrimport_no_update_ext_account_exists")." (".$this->cdata." for ".$loginForExternalAccount.")");
1956  }
1957  }
1958  break;
1959 
1960  }
1961  if ($externalAccountHasChanged)
1962  $this->userObj->setExternalAccount(trim($this->cdata));
1963  break;
1964 
1965  case "Active":
1966  if ($this->cdata != "true"
1967  && $this->cdata != "false")
1968  {
1969  $this->logFailure($this->userObj->getLogin(),
1970  sprintf($lng->txt("usrimport_xml_element_content_illegal"),"Active",$this->cdata));
1971  }
1972  $this->currActive = $this->cdata;
1973  break;
1974  case "TimeLimitOwner":
1975  if (!preg_match("/\d+/", $this->cdata))
1976  {
1977  $this->logFailure($this->userObj->getLogin(),
1978  sprintf($lng->txt("usrimport_xml_element_content_illegal"),"TimeLimitOwner",$this->cdata));
1979  }
1980  elseif(!$ilAccess->checkAccess('cat_administrate_users','',$this->cdata))
1981  {
1982  $this->logFailure($this->userObj->getLogin(),
1983  sprintf($lng->txt("usrimport_xml_element_content_illegal"),"TimeLimitOwner",$this->cdata));
1984  }
1985  elseif($ilObjDataCache->lookupType($ilObjDataCache->lookupObjId($this->cdata)) != 'cat' && !(int) $this->cdata == USER_FOLDER_ID)
1986  {
1987  $this->logFailure($this->userObj->getLogin(),
1988  sprintf($lng->txt("usrimport_xml_element_content_illegal"),"TimeLimitOwner",$this->cdata));
1989 
1990  }
1991  $this->userObj->setTimeLimitOwner($this->cdata);
1992  break;
1993  case "TimeLimitUnlimited":
1994  switch (strtolower($this->cdata))
1995  {
1996  case "true":
1997  case "1":
1998  $this->userObj->setTimeLimitUnlimited(1);
1999  break;
2000  case "false":
2001  case "0":
2002  $this->userObj->setTimeLimitUnlimited(0);
2003  break;
2004  default:
2005  $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_content_illegal"),"TimeLimitUnlimited",$this->cdata));
2006  break;
2007  }
2008  break;
2009  case "TimeLimitFrom":
2010  // Accept datetime or Unix timestamp
2011  if (strtotime($this->cdata) === false && ! is_numeric($this->cdata))
2012  {
2013  $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_content_illegal"),"TimeLimitFrom",$this->cdata));
2014  }
2015  $this->userObj->setTimeLimitFrom($this->cdata);
2016  break;
2017  case "TimeLimitUntil":
2018  // Accept datetime or Unix timestamp
2019  if (strtotime($this->cdata) === false && ! is_numeric($this->cdata))
2020  {
2021  $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_content_illegal"),"TimeLimitUntil",$this->cdata));
2022  }
2023  $this->userObj->setTimeLimitUntil($this->cdata);
2024  break;
2025  case "TimeLimitMessage":
2026  switch (strtolower($this->cdata))
2027  {
2028  case "1":
2029  $this->userObj->setTimeLimitMessage(1);
2030  break;
2031  case "0":
2032  $this->userObj->setTimeLimitMessage(0);
2033  break;
2034  default:
2035  $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_content_illegal"),"TimeLimitMessage",$this->cdata));
2036  break;
2037  }
2038  break;
2039  case "ApproveDate":
2040  // Accept datetime or Unix timestamp
2041  if (strtotime($this->cdata) === false && ! is_numeric($this->cdata) && !$this->cdata == "0000-00-00 00:00:00")
2042  {
2043  $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_content_illegal"),"ApproveDate",$this->cdata));
2044  }
2045  break;
2046  case "AgreeDate":
2047  // Accept datetime or Unix timestamp
2048  if (strtotime($this->cdata) === false && ! is_numeric($this->cdata) && !$this->cdata == "0000-00-00 00:00:00")
2049  {
2050  $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_content_illegal"),"AgreeDate",$this->cdata));
2051  }
2052  break;
2053  case "Pref":
2054  if ($this->currentPrefKey != null)
2055  $this->verifyPref($this->currentPrefKey, $this->cdata);
2056  $this->currentPrefKey == null;
2057  }
2058  }
const IL_PASSWD_PLAIN
_lookupExternalAccount($a_user_id)
lookup external account for login and authmethod
const IL_PASSWD_CRYPTED
static _lookupId($a_user_str)
lookup id by login
isFieldRequired($fieldname)
determine if a field $fieldname is to a required field (global setting)
const IL_FAIL_ON_CONFLICT
$currPasswordType
The password type of the current user.
static _getAuthModeName($a_auth_key)
logWarning($aLogin, $aMessage)
Writes a warning log message to the protocol.
getUserIdByLogin($a_login)
_lookupLogin($a_user_id)
lookup login
logFailure($aLogin, $aMessage)
Writes a failure log message to the protocol.
global $ilSetting
Definition: privfeed.php:40
static _checkExternalAuthAccount($a_auth, $a_account)
check whether external account and authentication method matches with a user
const USER_FOLDER_ID
Class ilObjUserFolder.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ verifyPref()

ilUserImportParser::verifyPref (   $key,
  $value 
)
private

Definition at line 2364 of file class.ilUserImportParser.php.

References ilTimeZone\_getInstance(), ilUserXMLWriter\isPrefExportable(), and logFailure().

Referenced by verifyEndTag().

2364  {
2365  switch ($key) {
2366  case 'mail_linebreak':
2367  case 'hits_per_page':
2368  if (!is_numeric($value) || $value < 0)
2369  $this->logFailure("---", "Wrong value '$value': Positiv numeric value expected for preference $key.");
2370  break;
2371  case 'language':
2372  case 'skin':
2373  case 'style':
2374  case 'ilPageEditor_HTMLMode':
2375  case 'ilPageEditor_JavaScript':
2376  case 'ilPageEditor_MediaMode':
2377  case 'tst_javascript':
2378  case 'tst_lastquestiontype':
2379  case 'tst_multiline_answers':
2380  case 'tst_use_previous_answers':
2381  case 'graphicalAnswerSetting':
2382  case 'priv_feed_pass':
2383  $this->logFailure("---", "Preference $key is not supported.");
2384  break;
2385  case 'public_city':
2386  case 'public_country':
2387  case 'public_department':
2388  case 'public_email':
2389  case 'public_fax':
2390  case 'public_hobby':
2391  case 'public_institution':
2392  case 'public_matriculation':
2393  case 'public_phone':
2394  case 'public_phone_home':
2395  case 'public_phone_mobile':
2396  case 'public_phone_office':
2397  case 'public_street':
2398  case 'public_upload':
2399  case 'public_zip':
2400  case 'public_interests_general':
2401  case 'public_interests_help_offered':
2402  case 'public_interests_help_looking':
2403  case 'send_info_mails':
2404  case 'hide_own_online_status':
2405  if (!in_array($value, array('y', 'n')))
2406  $this->logFailure("---", "Wrong value '$value': Value 'y' or 'n' expected for preference $key.");
2407  break;
2408  case 'public_profile':
2409  if (!in_array($value, array('y', 'n', 'g')))
2410  $this->logFailure("---", "Wrong value '$value': Value 'y', 'g' or 'n' expected for preference $key.");
2411  break;
2412  case 'show_users_online':
2413  if (!in_array($value, array('y', 'n', 'associated')))
2414  $this->logFailure("---", "Wrong value '$value': Value 'y' or 'n' or 'associated' expected for preference $key.");
2415  break;
2416  case 'mail_incoming_type':
2417  if (!in_array((int) $value, array("0","1","2")))
2418  $this->logFailure("---", "Wrong value '$value': Value \"0\" (LOCAL),\"1\" (EMAIL) or \"2\" (BOTH) expected for preference $key.");
2419  break;
2420  case 'weekstart':
2421  if (!in_array($value, array ("0","1")))
2422  $this->logFailure("---", "Wrong value '$value': Value \"0\" (Sunday) or \"1\" (Monday) expected for preference $key.");
2423  break;
2424 
2425  case 'mail_signature':
2426  break;
2427  case 'user_tz':
2428  include_once('Services/Calendar/classes/class.ilTimeZone.php');
2429  try {
2430  $tz = ilTimeZone::_getInstance($value);
2431  return true;
2432  } catch (ilTimeZoneException $tze) {
2433  $this->logFailure("---", "Wrong value '$value': Invalid timezone $value detected for preference $key.");
2434  }
2435  break;
2436  default:
2438  $this->logFailure("---", "Preference $key is not supported.");
2439  break;
2440  }
2441  }
static isPrefExportable($key)
returns wether a key from db is exportable or not
Class for TimeZone exceptions.
logFailure($aLogin, $aMessage)
Writes a failure log message to the protocol.
static _getInstance($a_tz='')
get instance by timezone
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $account_mail_cache

ilUserImportParser::$account_mail_cache = array()
staticprivate

Definition at line 275 of file class.ilUserImportParser.php.

◆ $action

ilUserImportParser::$action

The Action attribute determines what to do for the current User element.

This variable supports the following values: "Insert","Update","Delete".

Definition at line 65 of file class.ilUserImportParser.php.

Referenced by verifyBeginTag().

◆ $approve_date_set

ilUserImportParser::$approve_date_set = false

Definition at line 51 of file class.ilUserImportParser.php.

◆ $conflict_rule

ilUserImportParser::$conflict_rule

Conflict handling rule.

Values: IL_FAIL_ON_CONFLICT IL_UPDATE_ON_CONFLICT IL_IGNORE_ON_CONFLICT

Definition at line 93 of file class.ilUserImportParser.php.

◆ $currActive

ilUserImportParser::$currActive

The active state of the current user.

Definition at line 182 of file class.ilUserImportParser.php.

◆ $current_messenger_type

ilUserImportParser::$current_messenger_type
private

Definition at line 270 of file class.ilUserImportParser.php.

◆ $currPassword

ilUserImportParser::$currPassword

The password of the current user.

Definition at line 173 of file class.ilUserImportParser.php.

◆ $currPasswordSalt

ilUserImportParser::$currPasswordSalt
protected

Definition at line 178 of file class.ilUserImportParser.php.

◆ $currPasswordType

ilUserImportParser::$currPasswordType

The password type of the current user.

Definition at line 169 of file class.ilUserImportParser.php.

Referenced by verifyEndTag().

◆ $disableSkin

ilUserImportParser::$disableSkin

Indicates if the skins are enabled.

Definition at line 250 of file class.ilUserImportParser.php.

◆ $error_level

ilUserImportParser::$error_level

This variable is used to report the error level of the validation process or the importing process.

Values: IL_IMPORT_SUCCESS IL_IMPORT_WARNING IL_IMPORT_FAILURE

Meaning of the values when in validation mode: IL_IMPORT_WARNING Some of the entity actions can not be processed as specified in the XML file. One or more of the following conflicts have occurred:

  • An "Insert" action has been specified for a user who is already in the database.
  • An "Update" action has been specified for a user who is not in the database.
  • A "Delete" action has been specified for a user who is not in the database. IL_IMPORT_FAILURE Some of the XML elements are invalid.

Meaning of the values when in import mode: IL_IMPORT_WARNING Some of the entity actions have not beeen processed as specified in the XML file.

In IL_UPDATE_ON_CONFLICT mode, the following may have occured:

  • An "Insert" action has been replaced by a "Update" action for a user who is already in the database.
    • An "Update" action has been replaced by a "Insert" action for a user who is not in the database.
  • A "Delete" action has been replaced by a "Ignore" action for a user who is not in the database.

In IL_IGNORE_ON_CONFLICT mode, the following may have occured:

  • An "Insert" action has been replaced by a "Ignore" action for a user who is already in the database.
  • An "Update" action has been replaced by a "Ignore" action for a user who is not in the database.
    • A "Delete" action has been replaced by a "Ignore" action for a user who is not in the database.

IL_IMPORT_FAILURE The import could not be completed.

In IL_FAIL_ON_CONFLICT mode, the following may have occured:

  • An "Insert" action has failed for a user who is already in the database.
  • An "Update" action has failed for a user who is not in the database.
  • A "Delete" action has failed for a user who is not in the database.

Definition at line 164 of file class.ilUserImportParser.php.

Referenced by getErrorLevel().

◆ $folder_id

ilUserImportParser::$folder_id

Definition at line 59 of file class.ilUserImportParser.php.

Referenced by getFolderId().

◆ $hideSkin

ilUserImportParser::$hideSkin

Indicates if the skins are hidden.

Definition at line 245 of file class.ilUserImportParser.php.

◆ $localRoleCache

ilUserImportParser::$localRoleCache

Cached local roles.

This is used to speed up access to local roles. This is an associative array. The key is either a role_id or a role_id with the string "_courseMembersObject" appended. The value is a role object or the course members object for which the role is defined

Definition at line 210 of file class.ilUserImportParser.php.

◆ $logins

ilUserImportParser::$logins

This variable is used to collect each login that we encounter in the import data.

This variable is needed to detect duplicate logins in the import data. The variable is an associative array. (I would prefer using a set, but PHP does not appear to support sets.) Keys are logins. Values are logins.

Definition at line 84 of file class.ilUserImportParser.php.

◆ $mapping_mode

ilUserImportParser::$mapping_mode

Definition at line 201 of file class.ilUserImportParser.php.

Referenced by getUserMappingMode().

◆ $parentRolesCache

ilUserImportParser::$parentRolesCache

Cached parent roles.

This is used to speed up assignment to local roles with parents. This is an associative array. The key is a role_id . The value is an array of role_ids containing all parent roles.

Definition at line 225 of file class.ilUserImportParser.php.

◆ $personalPicture

ilUserImportParser::$personalPicture

Cached personal picture of the actual user This is used because the ilObjUser object has no field for the personal picture.

Definition at line 216 of file class.ilUserImportParser.php.

◆ $protocol

ilUserImportParser::$protocol

The variable holds the protocol of the import.

This variable is an associative array.

  • Keys are login names of users or "missing login", if the login name is missing.
  • Values are an array of error messages associated with the login. If the value array is empty, then the user was imported successfully.

Definition at line 74 of file class.ilUserImportParser.php.

Referenced by getProtocol().

◆ $roles

ilUserImportParser::$roles

Definition at line 60 of file class.ilUserImportParser.php.

Referenced by getCollectedRoles().

◆ $send_mail

ilUserImportParser::$send_mail

Definition at line 101 of file class.ilUserImportParser.php.

Referenced by isSendMail().

◆ $skin

ilUserImportParser::$skin

ILIAS skin.

Definition at line 230 of file class.ilUserImportParser.php.

◆ $style

ilUserImportParser::$style

ILIAS style.

Definition at line 235 of file class.ilUserImportParser.php.

◆ $time_limit_owner_set

ilUserImportParser::$time_limit_owner_set = false

Definition at line 53 of file class.ilUserImportParser.php.

◆ $time_limit_set

ilUserImportParser::$time_limit_set = false

Definition at line 52 of file class.ilUserImportParser.php.

◆ $updateLookAndSkin

ilUserImportParser::$updateLookAndSkin = false

boolean to determine if look and skin should be updated

Definition at line 58 of file class.ilUserImportParser.php.

◆ $user_id

ilUserImportParser::$user_id

Definition at line 257 of file class.ilUserImportParser.php.

Referenced by importEndTag(), and verifyEndTag().

◆ $user_mapping

ilUserImportParser::$user_mapping

Definition at line 193 of file class.ilUserImportParser.php.

Referenced by getUserMapping().

◆ $userCount

ilUserImportParser::$userCount

The count of user elements in the XML file.

Definition at line 186 of file class.ilUserImportParser.php.

Referenced by getUserCount().

◆ $userObj

ilUserImportParser::$userObj
private

Definition at line 263 of file class.ilUserImportParser.php.

◆ $userStyles

ilUserImportParser::$userStyles

User assigned styles.

Definition at line 240 of file class.ilUserImportParser.php.


The documentation for this class was generated from the following file: