ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ilSoapUserAdministration Class Reference
+ Inheritance diagram for ilSoapUserAdministration:
+ Collaboration diagram for ilSoapUserAdministration:

Public Member Functions

 login ($client, $username, $password)
 Soap login type $ilUser. More...
 
 loginCAS ($client, $PT, $username)
 
 loginLDAP ($client, $username, $password)
 Not required anymode. More...
 
 loginStudipUser ($sid, $user_id)
 login as user from Stud.IP More...
 
 logout ($sid)
 Logout user destroy session. More...
 
 lookupUser ($sid, $user_name)
 
 getUser ($sid, $user_id)
 
 deleteUser ($sid, $user_id)
 
 __readUserData (\ilObjUser &$usr_obj)
 
 importUsers ($sid, $folder_id, $usr_xml, $conflict_rule, $send_account_mail)
 define ("IL_FAIL_ON_CONFLICT", 1); define ("IL_UPDATE_ON_CONFLICT", 2); define ("IL_IGNORE_ON_CONFLICT", 3); More...
 
 getUsersForContainer ($sid, $ref_id, $attachRoles, $active)
 return list of users following dtd users_3_7 More...
 
 getUserForRole ($sid, $role_id, $attachRoles, $active)
 
 __getImportProtocolAsXML ($a_array)
 Create XML ResultSet. More...
 
 __getUserMappingAsXML ($a_array)
 return user mapping as xml More...
 
 searchUser ($sid, $a_keyfields, $query_operator, $a_keyvalues, $attach_roles, $active)
 return user xml following dtd 3.7 More...
 
 __buildSearchQuery ($a_keyfields, $queryOperator, $a_keyvalues)
 create search term according to parameters More...
 
 getUserXML ($sid, $a_user_ids, $attach_roles)
 return user xmls for given user ids (csv separated ids) as xml based on usr dtd. More...
 
 hasNewMail ($sid)
 
 getUserIdBySid ($sid)
 
- Public Member Functions inherited from ilSoapAdministration
 __construct ($use_nusoap=true)
 Constructor. More...
 
 initErrorWriter ()
 Overwrite error handler. More...
 
 __explodeSid ($sid)
 
 __setMessage ($a_str)
 
 __getMessage ()
 
 __appendMessage ($a_str)
 
 __setMessageCode ($a_code)
 
 __getMessageCode ()
 
 initAuth ($sid)
 Init authentication. More...
 
 initIlias ()
 
 __initAuthenticationObject ($a_auth_mode=AUTH_LOCAL)
 
 __raiseError ($a_message, $a_code)
 
 getNIC ($sid)
 get client information from current as xml result set More...
 
 isFault ($object)
 
 checkObjectAccess ($ref_id, $expected_type, $permission, $returnObject=false)
 check access for ref id: expected type, permission, return object instance if returnobject is true More...
 
 getInstallationInfoXML ()
 
 getClientInfoXML ($clientid)
 

Protected Member Functions

 isPermittedRole ($a_folder, $a_role)
 check if assignment is allowed More...
 

Additional Inherited Members

- Static Public Member Functions inherited from ilSoapAdministration
static return_bytes ($val)
 calculate bytes from K,M,G modifiers e.g: 8M = 8 * 1024 * 1024 bytes More...
 
- Data Fields inherited from ilSoapAdministration
 $sauth = null
 
 $error_method = null
 
- Protected Attributes inherited from ilSoapAdministration
 $soap_check = true
 

Detailed Description

Definition at line 35 of file class.ilSoapUserAdministration.php.

Member Function Documentation

◆ __buildSearchQuery()

ilSoapUserAdministration::__buildSearchQuery (   $a_keyfields,
  $queryOperator,
  $a_keyvalues 
)

create search term according to parameters

Parameters
arrayof string $a_keyfields
string$queryOperator
arrayof string $a_keyValues

Definition at line 981 of file class.ilSoapUserAdministration.php.

References $DIC, $ilDB, and $query.

Referenced by searchUser().

982  {
983  global $DIC;
984 
985  $ilDB = $DIC['ilDB'];
986  $query = array();
987 
988  $allowed_fields = array("firstname","lastname","email","login","matriculation","institution","department","title","ext_account");
989 
990  foreach ($a_keyfields as $keyfield) {
991  $keyfield = strtolower($keyfield);
992 
993  if (!in_array($keyfield, $allowed_fields)) {
994  continue;
995  }
996 
997  $field_query = array();
998  foreach ($a_keyvalues as $keyvalue) {
999  if (strlen($keyvalue) >= 3) {
1000  $field_query [] = $ilDB->like($ilDB->quoteIdentifier($keyfield), 'text', '%' . $keyvalue . "%");
1001  }
1002  }
1003  if (count($field_query)) {
1004  $query [] = join(" " . strtoupper($queryOperator) . " ", $field_query);
1005  }
1006  }
1007 
1008  return count($query) ? " AND ((" . join(") OR (", $query) . "))" : "AND 0";
1009  }
global $DIC
Definition: goto.php:24
$query
global $ilDB
+ Here is the caller graph for this function:

◆ __getImportProtocolAsXML()

ilSoapUserAdministration::__getImportProtocolAsXML (   $a_array)

Create XML ResultSet.

Definition at line 827 of file class.ilSoapUserAdministration.php.

References $message, $messages, and ilSoapAdministration\__raiseError().

Referenced by importUsers().

828  {
829  include_once './webservice/soap/classes/class.ilXMLResultSet.php';
830  include_once './webservice/soap/classes/class.ilXMLResultSetWriter.php';
831 
832  $xmlResultSet = new ilXMLResultSet();
833  $xmlResultSet->addColumn("userid");
834  $xmlResultSet->addColumn("login");
835  $xmlResultSet->addColumn("action");
836  $xmlResultSet->addColumn("message");
837 
838  foreach ($a_array as $username => $messages) {
839  foreach ($messages as $message) {
840  $xmlRow = new ilXMLResultSetRow();
841  $xmlRow->setValue(0, 0);
842  $xmlRow->setValue(1, $username);
843  $xmlRow->setValue(2, "");
844  $xmlRow->setValue(3, $message);
845 
846  $xmlResultSet->addRow($xmlRow);
847  }
848  }
849 
850  $xml_writer = new ilXMLResultSetWriter($xmlResultSet);
851 
852  if ($xml_writer->start()) {
853  return $xml_writer->getXML();
854  }
855 
856  return $this->__raiseError('Error in __getImportProtocolAsXML', 'Server');
857  }
XML Writer for XMLResultSet.
$messages
Definition: xapiexit.php:5
__raiseError($a_message, $a_code)
$message
Definition: xapiexit.php:14
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __getUserMappingAsXML()

ilSoapUserAdministration::__getUserMappingAsXML (   $a_array)

return user mapping as xml

Parameters
array(user_id => login) $a_array
Returns
XML String, following resultset.dtd

Definition at line 865 of file class.ilSoapUserAdministration.php.

References $message, and ilSoapAdministration\__raiseError().

Referenced by importUsers().

866  {
867  include_once './webservice/soap/classes/class.ilXMLResultSet.php';
868  include_once './webservice/soap/classes/class.ilXMLResultSetWriter.php';
869 
870  $xmlResultSet = new ilXMLResultSet();
871  $xmlResultSet->addColumn("userid");
872  $xmlResultSet->addColumn("login");
873  $xmlResultSet->addColumn("action");
874  $xmlResultSet->addColumn("message");
875 
876  if (count($a_array)) {
877  foreach ($a_array as $username => $message) {
878  $xmlRow = new ilXMLResultSetRow();
879  $xmlRow->setValue(0, $username);
880  $xmlRow->setValue(1, $message["login"]);
881  $xmlRow->setValue(2, $message["action"]);
882  $xmlRow->setValue(3, $message["message"]);
883 
884  $xmlResultSet->addRow($xmlRow);
885  }
886  }
887 
888  $xml_writer = new ilXMLResultSetWriter($xmlResultSet);
889 
890  if ($xml_writer->start()) {
891  return $xml_writer->getXML();
892  }
893 
894  return $this->__raiseError('Error in __getUserMappingAsXML', 'Server');
895  }
XML Writer for XMLResultSet.
__raiseError($a_message, $a_code)
$message
Definition: xapiexit.php:14
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __readUserData()

ilSoapUserAdministration::__readUserData ( \ilObjUser $usr_obj)

Definition at line 322 of file class.ilSoapUserAdministration.php.

References ilObjUser\getActive(), ilObjUser\getApproveDate(), ilObjUser\getAuthMode(), ilObjUser\getCity(), ilObjUser\getComment(), ilObjUser\getCountry(), ilObject\getCreateDate(), ilObjUser\getDepartment(), ilObjUser\getEmail(), ilObjUser\getFax(), ilObjUser\getFirstname(), ilObjUser\getGender(), ilObjUser\getHobby(), ilObject\getId(), ilObject\getImportId(), ilObjUser\getInstitution(), ilObjUser\getLanguage(), ilObjUser\getLastLogin(), ilObjUser\getLastname(), ilObjUser\getLastUpdate(), ilObjUser\getLogin(), ilObjUser\getMatriculation(), ilObjUser\getPasswd(), ilObjUser\getPasswdType(), ilObjUser\getPhoneHome(), ilObjUser\getPhoneMobile(), ilObjUser\getPhoneOffice(), ilObjUser\getPref(), ilObjUser\getSecondEmail(), ilObjUser\getStreet(), ilObjUser\getTimeLimitFrom(), ilObjUser\getTimeLimitMessage(), ilObjUser\getTimeLimitOwner(), ilObjUser\getTimeLimitUnlimited(), ilObjUser\getTimeLimitUntil(), ilObjUser\getUTitle(), ilObjUser\getZipcode(), and ilObjUser\hasToAcceptTermsOfService().

Referenced by getUser().

323  {
324  $usr_data['usr_id'] = $usr_obj->getId();
325  $usr_data['login'] = $usr_obj->getLogin();
326  $usr_data['passwd'] = $usr_obj->getPasswd();
327  $usr_data['passwd_type'] = $usr_obj->getPasswdType();
328  $usr_data['firstname'] = $usr_obj->getFirstname();
329  $usr_data['lastname'] = $usr_obj->getLastname();
330  $usr_data['title'] = $usr_obj->getUTitle();
331  $usr_data['gender'] = $usr_obj->getGender();
332  $usr_data['email'] = $usr_obj->getEmail();
333  $usr_data['second_email'] = $usr_obj->getSecondEmail();
334  $usr_data['institution'] = $usr_obj->getInstitution();
335  $usr_data['street'] = $usr_obj->getStreet();
336  $usr_data['city'] = $usr_obj->getCity();
337  $usr_data['zipcode'] = $usr_obj->getZipcode();
338  $usr_data['country'] = $usr_obj->getCountry();
339  $usr_data['phone_office'] = $usr_obj->getPhoneOffice();
340  $usr_data['last_login'] = $usr_obj->getLastLogin();
341  $usr_data['last_update'] = $usr_obj->getLastUpdate();
342  $usr_data['create_date'] = $usr_obj->getCreateDate();
343  $usr_data['hobby'] = $usr_obj->getHobby();
344  $usr_data['department'] = $usr_obj->getDepartment();
345  $usr_data['phone_home'] = $usr_obj->getPhoneHome();
346  $usr_data['phone_mobile'] = $usr_obj->getPhoneMobile();
347  $usr_data['fax'] = $usr_obj->getFax();
348  $usr_data['time_limit_owner'] = $usr_obj->getTimeLimitOwner();
349  $usr_data['time_limit_unlimited'] = $usr_obj->getTimeLimitUnlimited();
350  $usr_data['time_limit_from'] = $usr_obj->getTimeLimitFrom();
351  $usr_data['time_limit_until'] = $usr_obj->getTimeLimitUntil();
352  $usr_data['time_limit_message'] = $usr_obj->getTimeLimitMessage();
353  $usr_data['referral_comment'] = $usr_obj->getComment();
354  $usr_data['matriculation'] = $usr_obj->getMatriculation();
355  $usr_data['active'] = $usr_obj->getActive();
356  $usr_data['approve_date'] = $usr_obj->getApproveDate();
357  $usr_data['user_skin'] = $usr_obj->getPref('skin');
358  $usr_data['user_style'] = $usr_obj->getPref('style');
359  $usr_data['user_language'] = $usr_obj->getLanguage();
360  $usr_data['auth_mode'] = $usr_obj->getAuthMode();
361  $usr_data['accepted_agreement'] = !$usr_obj->hasToAcceptTermsOfService();
362  $usr_data['import_id'] = $usr_obj->getImportId();
363 
364  return $usr_data;
365  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteUser()

ilSoapUserAdministration::deleteUser (   $sid,
  $user_id 
)
Deprecated:

Definition at line 282 of file class.ilSoapUserAdministration.php.

References $DIC, $ilUser, $log, ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilObjectFactory\getInstanceByObjId(), ilSoapAdministration\initAuth(), ilSoapAdministration\initIlias(), SYSTEM_USER_ID, and USER_FOLDER_ID.

283  {
284  $this->initAuth($sid);
285  $this->initIlias();
286 
287  if (!$this->__checkSession($sid)) {
288  return $this->__raiseError($this->__getMessage(), $this->__getMessageCode());
289  }
290 
291  if (!isset($user_id)) {
292  return $this->__raiseError('No user_id given. Aborting', 'Client');
293  }
294 
295  global $DIC;
296 
297  $rbacsystem = $DIC['rbacsystem'];
298  $ilUser = $DIC['ilUser'];
299  $log = $DIC['log'];
300 
301  if (!$rbacsystem->checkAccess('delete', USER_FOLDER_ID)) {
302  return $this->__raiseError('Check access failed.', 'Server');
303  }
304 
305  if (!$ilUser->getLoginByUserId($user_id)) {
306  return $this->__raiseError('User id: ' . $user_id . ' is not a valid identifier. Aborting', 'Client');
307  }
308  if ($ilUser->getId() == $user_id) {
309  return $this->__raiseError('Cannot delete myself. Aborting', 'Client');
310  }
311  if ($user_id == SYSTEM_USER_ID) {
312  return $this->__raiseError('Cannot delete root account. Aborting', 'Client');
313  }
314  // Delete him
315  $log->write('SOAP: deleteUser()');
316  $delete_user =&ilObjectFactory::getInstanceByObjId($user_id, false);
317  $delete_user->delete();
318 
319  return true;
320  }
const USER_FOLDER_ID
Definition: constants.php:31
const SYSTEM_USER_ID
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: constants.php:24
$log
Definition: result.php:15
__raiseError($a_message, $a_code)
global $DIC
Definition: goto.php:24
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
initAuth($sid)
Init authentication.
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:

◆ getUser()

ilSoapUserAdministration::getUser (   $sid,
  $user_id 
)
Parameters
$sid
$user_id
Returns
mixed||
Exceptions

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

References $DIC, $ilUser, ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), __readUserData(), ilObjectFactory\getInstanceByObjId(), ilSoapAdministration\initAuth(), ilSoapAdministration\initIlias(), and USER_FOLDER_ID.

246  {
247  $this->initAuth($sid);
248  $this->initIlias();
249 
250  if (!$this->__checkSession($sid)) {
251  return $this->__raiseError($this->__getMessage(), $this->__getMessageCode());
252  }
253 
254  global $DIC;
255 
256  $access = $DIC->access();
257  $ilUser = $DIC->user();
258 
259  if (
260  !$access->checkAccess(
261  'read_users',
262  '',
264  )
265  ) {
266  return $this->__raiseError('Check access failed.', 'Server');
267  }
268 
269  if ($ilUser->getLoginByUserId($user_id)) {
270  $tmp_user =&ilObjectFactory::getInstanceByObjId($user_id);
271  $usr_data = $this->__readUserData($tmp_user);
272 
273  return $usr_data;
274  }
275  return $this->__raiseError('User does not exist', 'Client');
276  }
const USER_FOLDER_ID
Definition: constants.php:31
__raiseError($a_message, $a_code)
global $DIC
Definition: goto.php:24
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
initAuth($sid)
Init authentication.
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:

◆ getUserForRole()

ilSoapUserAdministration::getUserForRole (   $sid,
  $role_id,
  $attachRoles,
  $active 
)
Returns
list of users of a specific role, following dtd users_3_7

Definition at line 747 of file class.ilSoapUserAdministration.php.

References $data, $DIC, $ilDB, $ilUser, $type, ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilObjUser\_getUsersForRole(), ilObject\_lookupType(), ilSoapAdministration\initAuth(), ilSoapAdministration\initIlias(), SYSTEM_ROLE_ID, and USER_FOLDER_ID.

748  {
749  $this->initAuth($sid);
750  $this->initIlias();
751 
752  if (!$this->__checkSession($sid)) {
753  return $this->__raiseError($this->__getMessage(), $this->__getMessageCode());
754  }
755 
756  include_once './Services/AccessControl/classes/class.ilObjRole.php';
757  global $DIC;
758 
759  $ilDB = $DIC['ilDB'];
760  $rbacreview = $DIC['rbacreview'];
761  $tree = $DIC->repositoryTree();
762  $ilUser = $DIC->user();
763  $access = $DIC->access();
764 
765 
766  $global_roles = $rbacreview->getGlobalRoles();
767 
768 
769  if (in_array($role_id, $global_roles)) {
770  // global roles
771  if ($role_id == SYSTEM_ROLE_ID && !in_array(SYSTEM_ROLE_ID, $rbacreview->assignedRoles($ilUser->getId()))
772  ) {
773  return $this->__raiseError("Role access not permitted. ($role_id)", "Server");
774  }
775  } else {
776  // local roles
777  $rolfs = $rbacreview->getFoldersAssignedToRole($role_id, true);
778  $access_granted = true;
779  foreach ($rolfs as $rolf) {
780  if ($tree->isDeleted($rolf)) {
781  $access_granted = false;
782  }
783  $type = \ilObject::_lookupType($rolf, true);
784  switch ($type) {
785  case 'crs':
786  case 'grp':
787  if (!$access->checkAccess('manage_members', '', $rolf)) {
788  $access_granted = false;
789  }
790  break;
791  default:
792  if (!$access->checkAccess('edit_permission', '', $rolf)) {
793  $access_granted = false;
794  }
795  break;
796  }
797  }
798  // read user data must be granted
799  if (!$access->checkAccess('read_users', '', USER_FOLDER_ID)) {
800  $access_granted = false;
801  }
802  if (!$access_granted || !count($rolfs)) {
803  return $this->__raiseError('Role access not permitted. ' . '(' . $role_id .')', 'Server');
804  }
805  }
806 
807  $data = ilObjUser::_getUsersForRole($role_id, $active);
808  include_once './Services/User/classes/class.ilUserXMLWriter.php';
809 
810  $xmlWriter = new ilUserXMLWriter();
811  $xmlWriter->setAttachRoles($attachRoles);
812 
813  $xmlWriter->setObjects($data);
814 
815  if ($xmlWriter->start()) {
816  return $xmlWriter->getXML();
817  }
818  return $this->__raiseError('Error in getUsersForRole', 'Server');
819  }
$data
Definition: storeScorm.php:23
const USER_FOLDER_ID
Definition: constants.php:31
$type
const SYSTEM_ROLE_ID
Definition: constants.php:27
XML writer class.
__raiseError($a_message, $a_code)
global $DIC
Definition: goto.php:24
static _lookupType($a_id, $a_reference=false)
lookup object type
initAuth($sid)
Init authentication.
global $ilDB
static _getUsersForRole($role_id, $active=-1)
return array of complete users which belong to a specific role
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:

◆ getUserIdBySid()

ilSoapUserAdministration::getUserIdBySid (   $sid)

Definition at line 1090 of file class.ilSoapUserAdministration.php.

References $data, $DIC, $ilDB, $query, $res, ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilSoapAdministration\initAuth(), and ilSoapAdministration\initIlias().

1091  {
1092  $this->initAuth($sid);
1093  $this->initIlias();
1094 
1095  if (!$this->__checkSession($sid)) {
1096  return $this->__raiseError($this->__getMessage(), $this->__getMessageCode());
1097  }
1098 
1099  global $DIC;
1100 
1101  $ilDB = $DIC['ilDB'];
1102 
1103  $parts = explode('::', $sid);
1104  $query = "SELECT usr_id FROM usr_session "
1105  . "INNER JOIN usr_data ON usr_id = user_id WHERE session_id = %s";
1106  $res = $ilDB->queryF($query, array('text'), array($parts[0]));
1107  $data = $ilDB->fetchAssoc($res);
1108 
1109  if (!(int) $data['usr_id']) {
1110  $this->__raiseError('User does not exist', 'Client');
1111  }
1112 
1113  return (int) $data['usr_id'];
1114  }
$data
Definition: storeScorm.php:23
foreach($_POST as $key=> $value) $res
__raiseError($a_message, $a_code)
global $DIC
Definition: goto.php:24
$query
initAuth($sid)
Init authentication.
global $ilDB
+ Here is the call graph for this function:

◆ getUsersForContainer()

ilSoapUserAdministration::getUsersForContainer (   $sid,
  $ref_id,
  $attachRoles,
  $active 
)

return list of users following dtd users_3_7

Definition at line 658 of file class.ilSoapUserAdministration.php.

References $data, $DIC, $ilDB, ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilObjUser\_getUsersForFolder(), ilObjUser\_getUsersForGroup(), ilObjUser\_getUsersForIds(), ilObject\_lookupObjId(), ilSoapAdministration\checkObjectAccess(), ilSoapAdministration\initAuth(), ilSoapAdministration\initIlias(), ilSoapAdministration\isFault(), and USER_FOLDER_ID.

659  {
660  $this->initAuth($sid);
661  $this->initIlias();
662 
663  if (!$this->__checkSession($sid)) {
664  return $this->__raiseError($this->__getMessage(), $this->__getMessageCode());
665  }
666 
667  global $DIC;
668 
669  $ilDB = $DIC['ilDB'];
670  $tree = $DIC['tree'];
671  $rbacreview = $DIC['rbacreview'];
672  $rbacsystem = $DIC['rbacsystem'];
673  $access = $DIC->access();
674 
675  if ($ref_id == -1) {
677  }
678 
679  if (
680  $ref_id == USER_FOLDER_ID &&
681  !$access->checkAccess('read_users', '', USER_FOLDER_ID)
682  ) {
683  return $this->__raiseError('Access denied', "Client");
684  }
685 
686 
687  $object = $this->checkObjectAccess($ref_id, array("crs","cat","grp","usrf","sess"), "read", true);
688  if ($this->isFault($object)) {
689  return $object;
690  }
691 
692  $data = array();
693  switch ($object->getType()) {
694  case "usrf":
696  break;
697  case "cat":
699  break;
700  case "crs":
701  {
702  // GET ALL MEMBERS
703  $roles = $object->__getLocalRoles();
704 
705  foreach ($roles as $role_id) {
706  $data = array_merge($rbacreview->assignedUsers($role_id), $data);
707  }
708 
709  break;
710  }
711  case "grp":
712  $member_ids = $object->getGroupMemberIds();
713  $data = ilObjUser::_getUsersForGroup($member_ids, $active);
714  break;
715  case "sess":
716  $course_ref_id = $tree->checkForParentType($ref_id, 'crs');
717  if (!$course_ref_id) {
718  return $this->__raiseError("No course for session", "Client");
719  }
720 
721  $event_obj_id = ilObject::_lookupObjId($ref_id);
722  include_once 'Modules/Session/classes/class.ilEventParticipants.php';
723  $event_part = new ilEventParticipants($event_obj_id);
724  $member_ids = array_keys($event_part->getParticipants());
725  $data = ilObjUser::_getUsersForIds($member_ids, $active);
726  break;
727  }
728 
729  if (is_array($data)) {
730  include_once './Services/User/classes/class.ilUserXMLWriter.php';
731 
732  $xmlWriter = new ilUserXMLWriter();
733  $xmlWriter->setObjects($data);
734  $xmlWriter->setAttachRoles($attachRoles);
735 
736  if ($xmlWriter->start()) {
737  return $xmlWriter->getXML();
738  }
739  }
740  return $this->__raiseError('Error in processing information. This is likely a bug.', 'Server');
741  }
$data
Definition: storeScorm.php:23
checkObjectAccess($ref_id, $expected_type, $permission, $returnObject=false)
check access for ref id: expected type, permission, return object instance if returnobject is true ...
const USER_FOLDER_ID
Definition: constants.php:31
XML writer class.
static _lookupObjId($a_id)
__raiseError($a_message, $a_code)
global $DIC
Definition: goto.php:24
static _getUsersForFolder($ref_id, $active)
get users for a category or from system folder
static _getUsersForGroup($a_mem_ids, $active=-1)
return user data for group members
initAuth($sid)
Init authentication.
global $ilDB
static _getUsersForIds($a_mem_ids, $active=-1, $timelimitowner=-1)
return user data for given user id
+ Here is the call graph for this function:

◆ getUserXML()

ilSoapUserAdministration::getUserXML (   $sid,
  $a_user_ids,
  $attach_roles 
)

return user xmls for given user ids (csv separated ids) as xml based on usr dtd.

Parameters
stringsid session id
stringa_userids array of user ids, may be numeric or ilias ids
booleanattachRoles if true, role assignments will be attached, nothing will be done otherwise
Returns
string xml string based on usr dtd

Definition at line 1019 of file class.ilSoapUserAdministration.php.

References $data, $DIC, $ilDB, $ilUser, ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilObjUser\_getUserData(), ilSoapAdministration\initAuth(), ilSoapAdministration\initIlias(), and USER_FOLDER_ID.

1020  {
1021  $this->initAuth($sid);
1022  $this->initIlias();
1023 
1024  if (!$this->__checkSession($sid)) {
1025  return $this->__raiseError($this->__getMessage(), $this->__getMessageCode());
1026  }
1027 
1028  global $DIC;
1029 
1030  $rbacsystem = $DIC['rbacsystem'];
1031  $access = $DIC->access();
1032  $ilUser = $DIC['ilUser'];
1033  $ilDB = $DIC['ilDB'];
1034 
1035  // check if own account
1036  $is_self = false;
1037  if (is_array($a_user_ids) and count($a_user_ids) == 1) {
1038  if (end($a_user_ids) == $ilUser->getId()) {
1039  $is_self = true;
1040  }
1041  } elseif (is_numeric($a_user_ids)) {
1042  if ($a_user_ids == $ilUser->getId()) {
1043  $is_self = true;
1044  }
1045  }
1046 
1047  if (!$access->checkAccess('read_users', '', USER_FOLDER_ID) && !$is_self) {
1048  return $this->__raiseError('Check access failed.', 'Server');
1049  }
1050 
1051 
1052  // begin-patch filemanager
1053  $data = ilObjUser::_getUserData((array) $a_user_ids);
1054  // end-patch filemanager
1055 
1056  include_once './Services/User/classes/class.ilUserXMLWriter.php';
1057  $xmlWriter = new ilUserXMLWriter();
1058  $xmlWriter->setAttachRoles($attach_roles);
1059  $xmlWriter->setObjects($data);
1060 
1061  if ($xmlWriter->start()) {
1062  return $xmlWriter->getXML();
1063  }
1064 
1065  return $this->__raiseError('User does not exist', 'Client');
1066  }
$data
Definition: storeScorm.php:23
const USER_FOLDER_ID
Definition: constants.php:31
XML writer class.
__raiseError($a_message, $a_code)
global $DIC
Definition: goto.php:24
initAuth($sid)
Init authentication.
global $ilDB
$ilUser
Definition: imgupload.php:18
static _getUserData($a_internalids)
return user data for given user ids
+ Here is the call graph for this function:

◆ hasNewMail()

ilSoapUserAdministration::hasNewMail (   $sid)

Definition at line 1070 of file class.ilSoapUserAdministration.php.

References $DIC, $ilUser, ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilMailGlobalServices\getNewMailsData(), ilSoapAdministration\initAuth(), and ilSoapAdministration\initIlias().

1071  {
1072  $this->initAuth($sid);
1073  $this->initIlias();
1074 
1075  if (!$this->__checkSession($sid)) {
1076  return $this->__raiseError($this->__getMessage(), $this->__getMessageCode());
1077  }
1078 
1079  global $DIC;
1080 
1081  $ilUser = $DIC['ilUser'];
1082 
1083  if (ilMailGlobalServices::getNewMailsData((int) $ilUser->getId())['count'] > 0) {
1084  return true;
1085  } else {
1086  return false;
1087  }
1088  }
static getNewMailsData(int $usr_id, int $leftInterval=0)
Determines the number of new mails for the passed user id and stores this information in a local cach...
__raiseError($a_message, $a_code)
global $DIC
Definition: goto.php:24
initAuth($sid)
Init authentication.
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:

◆ importUsers()

ilSoapUserAdministration::importUsers (   $sid,
  $folder_id,
  $usr_xml,
  $conflict_rule,
  $send_account_mail 
)

define ("IL_FAIL_ON_CONFLICT", 1); define ("IL_UPDATE_ON_CONFLICT", 2); define ("IL_IGNORE_ON_CONFLICT", 3);

Definition at line 373 of file class.ilSoapUserAdministration.php.

References $DIC, $ilUser, $lng, ilUtil\__extractId(), __getImportProtocolAsXML(), ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), __getUserMappingAsXML(), ilSoapAdministration\__raiseError(), ilObjRole\_getAssignUsersStatus(), ilObject\_lookupTitle(), domxml_open_mem(), ilObjectFactory\getInstanceByRefId(), IL_EXTRACT_ROLES, IL_FAIL_ON_CONFLICT, IL_IGNORE_ON_CONFLICT, IL_IMPORT_FAILURE, IL_IMPORT_SUCCESS, IL_IMPORT_WARNING, IL_INST_ID, IL_UPDATE_ON_CONFLICT, IL_USER_IMPORT, IL_USER_MAPPING_ID, IL_VERIFY, ilSoapAdministration\initAuth(), ilSoapAdministration\initIlias(), isPermittedRole(), SYSTEM_ROLE_ID, and USER_FOLDER_ID.

374  {
375  $this->initAuth($sid);
376  $this->initIlias();
377 
378  if (!$this->__checkSession($sid)) {
379  return $this->__raiseError($this->__getMessage(), $this->__getMessageCode());
380  }
381 
382 
383  include_once './Services/User/classes/class.ilUserImportParser.php';
384  include_once './Services/AccessControl/classes/class.ilObjRole.php';
385  include_once './Services/Object/classes/class.ilObjectFactory.php';
386  global $DIC;
387 
388  $rbacreview = $DIC['rbacreview'];
389  $rbacsystem = $DIC['rbacsystem'];
390  $access = $DIC->access();
391  $tree = $DIC['tree'];
392  $lng = $DIC['lng'];
393  $ilUser = $DIC['ilUser'];
394  $ilLog = $DIC['ilLog'];
395 
396  // this takes time but is nescessary
397  $error = false;
398 
399 
400  // validate to prevent wrong XMLs
401  $this->dom = @domxml_open_mem($usr_xml, DOMXML_LOAD_VALIDATING, $error);
402  if ($error) {
403  $msg = array();
404  if (is_array($error)) {
405  foreach ($error as $err) {
406  $msg []= "(" . $err["line"] . "," . $err["col"] . "): " . $err["errormessage"];
407  }
408  } else {
409  $msg[] = $error;
410  }
411  $msg = join("\n", $msg);
412  return $this->__raiseError($msg, "Client");
413  }
414 
415 
416  switch ($conflict_rule) {
417  case 2:
418  $conflict_rule = IL_UPDATE_ON_CONFLICT;
419  break;
420  case 3:
421  $conflict_rule = IL_IGNORE_ON_CONFLICT;
422  break;
423  default:
424  $conflict_rule = IL_FAIL_ON_CONFLICT;
425  }
426  if ($folder_id == 0) {
427  if (!$access->checkAccess('create_usr', '', USER_FOLDER_ID)) {
428  return $this->__raiseError('Missing permission for creating/modifying users accounts' . USER_FOLDER_ID . ' ' . $ilUser->getId(), 'Server');
429  }
430  }
431 
432  // folder id 0, means to check permission on user basis!
433  // must have create user right in time_limit_owner property (which is ref_id of container)
434  if ($folder_id != 0) {
435  // determine where to import
436  if ($folder_id == -1) {
437  $folder_id = USER_FOLDER_ID;
438  }
439 
440  // get folder
441  $import_folder = ilObjectFactory::getInstanceByRefId($folder_id, false);
442  // id does not exist
443  if (!$import_folder) {
444  return $this->__raiseError('Wrong reference id.', 'Server');
445  }
446 
447  // folder is not a folder, can also be a category
448  if ($import_folder->getType() != "usrf" && $import_folder->getType() != "cat") {
449  return $this->__raiseError('Folder must be a usr folder or a category.', 'Server');
450  }
451 
452  // check access to folder
453  if (!$rbacsystem->checkAccess('create_usr', $folder_id)) {
454  return $this->__raiseError('Missing permission for creating users within ' . $import_folder->getTitle(), 'Server');
455  }
456  }
457 
458  // first verify
459  $importParser = new ilUserImportParser("", IL_VERIFY, $conflict_rule);
460  $importParser->setUserMappingMode(IL_USER_MAPPING_ID);
461  $importParser->setXMLContent($usr_xml);
462  $importParser->startParsing();
463 
464  switch ($importParser->getErrorLevel()) {
465  case IL_IMPORT_SUCCESS:
466  break;
467  case IL_IMPORT_WARNING:
468  return $this->__getImportProtocolAsXML($importParser->getProtocol("User Import Log - Warning"));
469  break;
470  case IL_IMPORT_FAILURE:
471  return $this->__getImportProtocolAsXML($importParser->getProtocol("User Import Log - Failure"));
472  }
473 
474  // verify is ok, so get role assignments
475 
476  $importParser = new ilUserImportParser("", IL_EXTRACT_ROLES, $conflict_rule);
477  $importParser->setXMLContent($usr_xml);
478  $importParser->setUserMappingMode(IL_USER_MAPPING_ID);
479  $importParser->startParsing();
480 
481  $roles = $importParser->getCollectedRoles();
482 
483  //print_r($roles);
484 
485 
486 
487  // roles to be assigned, skip if one is not allowed!
488  $permitted_roles = array();
489  foreach ($roles as $role_id => $role) {
490  if (!is_numeric($role_id)) {
491  // check if internal id
492  $internalId = ilUtil::__extractId($role_id, IL_INST_ID);
493 
494  if (is_numeric($internalId)) {
495  $role_id = $internalId;
496  $role_name = $role_id;
497  }
498  /* else // perhaps it is a rolename
499  {
500  $role = ilSoapUserAdministration::__getRoleForRolename ($role_id);
501  $role_name = $role->title;
502  $role_id = $role->role_id;
503  }*/
504  }
505 
506  if ($this->isPermittedRole($folder_id, $role_id)) {
507  $permitted_roles[$role_id] = $role_id;
508  } else {
509  $role_name = ilObject::_lookupTitle($role_id);
510  return $this->__raiseError("Could not find role " . $role_name . ". Either you use an invalid/deleted role " .
511  "or you try to assign a local role into the non-standard user folder and this role is not in its subtree.", 'Server');
512  }
513  }
514 
515  $global_roles = $rbacreview->getGlobalRoles();
516 
517  //print_r ($global_roles);
518 
519 
520 
521  foreach ($permitted_roles as $role_id => $role_name) {
522  if ($role_id != "") {
523  if (in_array($role_id, $global_roles)) {
524  if ($role_id == SYSTEM_ROLE_ID && !in_array(SYSTEM_ROLE_ID, $rbacreview->assignedRoles($ilUser->getId()))
525  || ($folder_id != USER_FOLDER_ID && $folder_id != 0 && !ilObjRole::_getAssignUsersStatus($role_id))
526  ) {
527  return $this->__raiseError($lng->txt("usrimport_with_specified_role_not_permitted") . " $role_name ($role_id)", 'Server');
528  }
529  } else {
530  $rolf = $rbacreview->getFoldersAssignedToRole($role_id, true);
531  if ($rbacreview->isDeleted($rolf[0])
532  || !$rbacsystem->checkAccess('write', $rolf[0])) {
533  return $this->__raiseError($lng->txt("usrimport_with_specified_role_not_permitted") . " $role_name ($role_id)", "Server");
534  }
535  }
536  }
537  }
538 
539  //print_r ($permitted_roles);
540 
541  $importParser = new ilUserImportParser("", IL_USER_IMPORT, $conflict_rule);
542  $importParser->setSendMail($send_account_mail);
543  $importParser->setUserMappingMode(IL_USER_MAPPING_ID);
544  $importParser->setFolderId($folder_id);
545  $importParser->setXMLContent($usr_xml);
546 
547  $importParser->setRoleAssignment($permitted_roles);
548 
549  $importParser->startParsing();
550 
551  if ($importParser->getErrorLevel() != IL_IMPORT_FAILURE) {
552  return $this->__getUserMappingAsXML($importParser->getUserMapping());
553  }
554  return $this->__getImportProtocolAsXML($importParser->getProtocol());
555  }
const IL_INST_ID
Definition: constants.php:38
const USER_FOLDER_ID
Definition: constants.php:31
const IL_USER_IMPORT
const SYSTEM_ROLE_ID
Definition: constants.php:27
const IL_IMPORT_FAILURE
domxml_open_mem($str, $mode=0, &$error=null)
const IL_EXTRACT_ROLES
static _lookupTitle($a_id)
lookup object title
const IL_FAIL_ON_CONFLICT
const IL_IMPORT_WARNING
static _getAssignUsersStatus($a_role_id)
isPermittedRole($a_folder, $a_role)
check if assignment is allowed
const IL_IMPORT_SUCCESS
__getImportProtocolAsXML($a_array)
Create XML ResultSet.
$lng
const IL_USER_MAPPING_ID
__raiseError($a_message, $a_code)
global $DIC
Definition: goto.php:24
const IL_VERIFY
initAuth($sid)
Init authentication.
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
$ilUser
Definition: imgupload.php:18
static __extractId($ilias_id, $inst_id)
extract ref id from role title, e.g.
__getUserMappingAsXML($a_array)
return user mapping as xml
const IL_UPDATE_ON_CONFLICT
const IL_IGNORE_ON_CONFLICT
+ Here is the call graph for this function:

◆ isPermittedRole()

ilSoapUserAdministration::isPermittedRole (   $a_folder,
  $a_role 
)
protected

check if assignment is allowed

protected

Parameters

Definition at line 564 of file class.ilSoapUserAdministration.php.

References $DIC, $ilUser, $location, ilObjRole\_getAssignUsersStatus(), ANONYMOUS_ROLE_ID, ROLE_FOLDER_ID, SYSTEM_ROLE_ID, and USER_FOLDER_ID.

Referenced by importUsers().

565  {
566  static $checked_roles = array();
567  static $global_roles = null;
568 
569 
570  if (isset($checked_roles[$a_role])) {
571  return $checked_roles[$a_role];
572  }
573 
574  global $DIC;
575 
576  $rbacsystem = $DIC['rbacsystem'];
577  $rbacreview = $DIC['rbacreview'];
578  $ilUser = $DIC['ilUser'];
579  $tree = $DIC['tree'];
580  $ilLog = $DIC['ilLog'];
581 
582  $locations = $rbacreview->getFoldersAssignedToRole($a_role, true);
583  $location = $locations[0];
584 
585  // global role
586  if ($location == ROLE_FOLDER_ID) {
587  $ilLog->write(__METHOD__ . ': Check global role');
588  // check assignment permission if called from local admin
589 
590 
591  if ($a_folder != USER_FOLDER_ID and $a_folder != 0) {
592  $ilLog->write(__METHOD__ . ': ' . $a_folder);
593  include_once './Services/AccessControl/classes/class.ilObjRole.php';
594  if (!ilObjRole::_getAssignUsersStatus($a_role)) {
595  $ilLog->write(__METHOD__ . ': No assignment allowed');
596  $checked_roles[$a_role] = false;
597  return false;
598  }
599  }
600  // exclude anonymous role from list
601  if ($a_role == ANONYMOUS_ROLE_ID) {
602  $ilLog->write(__METHOD__ . ': Anonymous role chosen.');
603  $checked_roles[$a_role] = false;
604  return false;
605  }
606  // do not allow to assign users to administrator role if current user does not has SYSTEM_ROLE_ID
607  if ($a_role == SYSTEM_ROLE_ID and !in_array(SYSTEM_ROLE_ID, $rbacreview->assignedRoles($ilUser->getId()))) {
608  $ilLog->write(__METHOD__ . ': System role assignment forbidden.');
609  $checked_roles[$a_role] = false;
610  return false;
611  }
612 
613  // Global role assignment ok
614  $ilLog->write(__METHOD__ . ': Assignment allowed.');
615  $checked_roles[$a_role] = true;
616  return true;
617  } elseif ($location) {
618  $ilLog->write(__METHOD__ . ': Check local role.');
619 
620  // It's a local role
621  $rolfs = $rbacreview->getFoldersAssignedToRole($a_role, true);
622  $rolf = $rolfs[0];
623 
624 
625  // only process role folders that are not set to status "deleted"
626  // and for which the user has write permissions.
627  // We also don't show the roles which are in the ROLE_FOLDER_ID folder.
628  // (The ROLE_FOLDER_ID folder contains the global roles).
629  if ($rbacreview->isDeleted($rolf)
630  || !$rbacsystem->checkAccess('edit_permission', $rolf)) {
631  $ilLog->write(__METHOD__ . ': Role deleted or no permission.');
632  $checked_roles[$a_role] = false;
633  return false;
634  }
635  // A local role is only displayed, if it is contained in the subtree of
636  // the localy administrated category. If the import function has been
637  // invoked from the user folder object, we show all local roles, because
638  // the user folder object is considered the parent of all local roles.
639  // Thus, if we start from the user folder object, we initializ$isInSubtree = $folder_id == USER_FOLDER_ID || $folder_id == 0;e the
640  // isInSubtree variable with true. In all other cases it is initialized
641  // with false, and only set to true if we find the object id of the
642  // locally administrated category in the tree path to the local role.
643  if ($a_folder != USER_FOLDER_ID and $a_folder != 0 and !$tree->isGrandChild($a_folder, $rolf)) {
644  $ilLog->write(__METHOD__ . ': Not in path of category.');
645  $checked_roles[$a_role] = false;
646  return false;
647  }
648  $ilLog->write(__METHOD__ . ': Assignment allowed.');
649  $checked_roles[$a_role] = true;
650  return true;
651  }
652  }
const USER_FOLDER_ID
Definition: constants.php:31
$location
Definition: buildRTE.php:44
const SYSTEM_ROLE_ID
Definition: constants.php:27
static _getAssignUsersStatus($a_role_id)
global $DIC
Definition: goto.php:24
const ROLE_FOLDER_ID
Definition: constants.php:32
const ANONYMOUS_ROLE_ID
Definition: constants.php:26
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ login()

ilSoapUserAdministration::login (   $client,
  $username,
  $password 
)

Soap login type $ilUser.

Parameters
type$client
type$username
type$password
Returns
type

Definition at line 46 of file class.ilSoapUserAdministration.php.

References $_COOKIE, $client, Vendor\Package\$e, $GLOBALS, $password, ilSoapAdministration\__raiseError(), ilAuthFrontendFactory\CONTEXT_CLI, ilAuthStatus\getInstance(), ilLoggerFactory\getLogger(), ilSoapAdministration\initIlias(), ilAuthStatus\STATUS_AUTHENTICATED, and ilAuthStatus\STATUS_AUTHENTICATION_FAILED.

Referenced by loginLDAP().

47  {
48  unset($_COOKIE[session_name()]);
49  $_COOKIE['ilClientId'] = $client;
50 
51  try {
52  $this->initIlias();
53  } catch (Exception $e) {
54  return $this->__raiseError($e->getMessage(), 'Server');
55  }
56 
57  // now try authentication
58  include_once './Services/Authentication/classes/Frontend/class.ilAuthFrontendCredentials.php';
59  $credentials = new ilAuthFrontendCredentials();
60  $credentials->setUsername($username);
61  $credentials->setPassword($password);
62 
63  include_once './Services/Authentication/classes/Provider/class.ilAuthProviderFactory.php';
64  $provider_factory = new ilAuthProviderFactory();
65  $providers = $provider_factory->getProviders($credentials);
66 
67  include_once './Services/Authentication/classes/class.ilAuthStatus.php';
68  $status = ilAuthStatus::getInstance();
69 
70  include_once './Services/Authentication/classes/Frontend/class.ilAuthFrontendFactory.php';
71  $frontend_factory = new ilAuthFrontendFactory();
72  $frontend_factory->setContext(ilAuthFrontendFactory::CONTEXT_CLI);
73  $frontend = $frontend_factory->getFrontend(
74  $GLOBALS['DIC']['ilAuthSession'],
75  $status,
76  $credentials,
77  $providers
78  );
79 
80  $frontend->authenticate();
81 
82  switch ($status->getStatus()) {
84  ilLoggerFactory::getLogger('auth')->debug('Authentication successful.');
85  return $GLOBALS['DIC']['ilAuthSession']->getId() . '::' . $client;
86 
87 
88  default:
90  return $this->__raiseError(
91  $status->getReason(),
92  'Server'
93  );
94  }
95  return true;
96  }
const STATUS_AUTHENTICATION_FAILED
Factory for auth frontend classes.
if($_SERVER['argc']< 4) $client
Definition: cron.php:12
__raiseError($a_message, $a_code)
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
$password
Definition: cron.php:14
static getInstance()
Get status instance.
static getLogger($a_component_id)
Get component logger.
$_COOKIE[session_name()]
Definition: xapitoken.php:37
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loginCAS()

ilSoapUserAdministration::loginCAS (   $client,
  $PT,
  $username 
)

Definition at line 99 of file class.ilSoapUserAdministration.php.

References $client, ilSoapAdministration\__initAuthenticationObject(), ilSoapAdministration\__raiseError(), and AUTH_CAS.

100  {
102  $this->sauth->setClient($client);
103  $this->sauth->setUsername($username);
104  $this->sauth->setPT($PT);
105  $authenticated = true;
106  if (!$this->sauth->authenticate()) {
107  $authenticated = false;
108  }
109  if (!$authenticated) {
110  return $this->__raiseError($this->sauth->getMessage(), $this->sauth->getMessageCode());
111  }
112  return $this->sauth->getSid() . '::' . $client;
113  }
const AUTH_CAS
if($_SERVER['argc']< 4) $client
Definition: cron.php:12
__initAuthenticationObject($a_auth_mode=AUTH_LOCAL)
__raiseError($a_message, $a_code)
+ Here is the call graph for this function:

◆ loginLDAP()

ilSoapUserAdministration::loginLDAP (   $client,
  $username,
  $password 
)

Not required anymode.

This method is a simple alias for login()

Parameters
type$client
type$username
type$password
Returns
type
Deprecated:
since version 5.2

Definition at line 124 of file class.ilSoapUserAdministration.php.

References $client, $password, and login().

125  {
126  return $this->login($client, $username, $password);
127  }
if($_SERVER['argc']< 4) $client
Definition: cron.php:12
login($client, $username, $password)
Soap login type $ilUser.
$password
Definition: cron.php:14
+ Here is the call graph for this function:

◆ loginStudipUser()

ilSoapUserAdministration::loginStudipUser (   $sid,
  $user_id 
)

login as user from Stud.IP

Deprecated:
Parameters
string$sid
int$user_id
Returns
string $sid

Definition at line 136 of file class.ilSoapUserAdministration.php.

References $_COOKIE, $client, $DIC, $GLOBALS, $ilIliasIniFile, $ilUser, ilSoapAdministration\__explodeSid(), ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilSoapAdministration\initAuth(), ilSoapAdministration\initIlias(), ilSession\SESSION_CLOSE_USER, ilSession\setClosingContext(), and SYSTEM_ROLE_ID.

137  {
138  global $DIC;
139 
140  $rbacreview = $DIC['rbacreview'];
141  $ilUser = $DIC['ilUser'];
142  $ilIliasIniFile = $DIC['ilIliasIniFile'];
143 
144  $this->initAuth($sid);
145  $this->initIlias();
146  list($admin_sid, $client) = $this->__explodeSid($sid);
147 
148  if (!$this->__checkSession($sid)) {
149  return $this->__raiseError($this->__getMessage(), $this->__getMessageCode());
150  }
151 
152  if (!$ilIliasIniFile->readVariable('server', 'studip')) {
153  return $this->__raiseError('Stud.IP mode not active.', 'Server');
154  }
155 
156  if (!$rbacreview->isAssigned($ilUser->getId(), SYSTEM_ROLE_ID)) {
157  return $this->__raiseError('No permission to initialize user session.', 'Server');
158  }
159 
160  if ($ilUser->getLoginByUserId($user_id)) {
161  // logout admin
162  include_once './Services/Authentication/classes/class.ilSession.php';
164  $GLOBALS['DIC']['ilAuthSession']->logout();
165  unset($_COOKIE[session_name()]);
166 
167  // init session and set user as authenticated
168  $_COOKIE['ilClientId'] = $client;
169  $GLOBALS['DIC']['ilAuthSession']->init();
170  $GLOBALS['DIC']['ilAuthSession']->setAuthenticated(true, $user_id);
171  return (session_id() . '::' . $client);
172  }
173  return $this->__raiseError('User does not exist', 'Client');
174  }
const SYSTEM_ROLE_ID
Definition: constants.php:27
if($_SERVER['argc']< 4) $client
Definition: cron.php:12
$ilIliasIniFile
Definition: imgupload.php:16
const SESSION_CLOSE_USER
__raiseError($a_message, $a_code)
global $DIC
Definition: goto.php:24
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
static setClosingContext($a_context)
set closing context (for statistics)
initAuth($sid)
Init authentication.
$ilUser
Definition: imgupload.php:18
$_COOKIE[session_name()]
Definition: xapitoken.php:37
+ Here is the call graph for this function:

◆ logout()

ilSoapUserAdministration::logout (   $sid)

Logout user destroy session.

Parameters
string$sid
Returns
type

Definition at line 181 of file class.ilSoapUserAdministration.php.

References $GLOBALS, ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilSoapAdministration\initAuth(), ilSoapAdministration\initIlias(), ilSession\SESSION_CLOSE_USER, and ilSession\setClosingContext().

182  {
183  $this->initAuth($sid);
184  $this->initIlias();
185 
186  if (!$this->__checkSession($sid)) {
187  return $this->__raiseError($this->__getMessage(), $this->__getMessageCode());
188  }
189 
190  include_once './Services/Authentication/classes/class.ilSession.php';
192  $GLOBALS['DIC']['ilAuthSession']->logout();
193  return true;
194  }
const SESSION_CLOSE_USER
__raiseError($a_message, $a_code)
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
static setClosingContext($a_context)
set closing context (for statistics)
initAuth($sid)
Init authentication.
+ Here is the call graph for this function:

◆ lookupUser()

ilSoapUserAdministration::lookupUser (   $sid,
  $user_name 
)
Parameters
$sid
$user_name
Returns
int|||string

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

References $DIC, $ilUser, ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilObjUser\getUserIdByLogin(), ilSoapAdministration\initAuth(), ilSoapAdministration\initIlias(), and USER_FOLDER_ID.

202  {
203  $this->initAuth($sid);
204  $this->initIlias();
205 
206  if (!$this->__checkSession($sid)) {
207  return $this->__raiseError($this->__getMessage(), $this->__getMessageCode());
208  }
209 
210  $user_name = trim($user_name);
211 
212  if (!strlen($user_name)) {
213  return $this->__raiseError('No username given. Aborting', 'Client');
214  }
215 
216  global $DIC;
217 
218  $ilUser = $DIC->user();
219  $access = $DIC->access();
220 
221  if (
222  strcasecmp($ilUser->getLogin(), $user_name) !== 0 &&
223  !$access->checkAccess(
224  'read_users',
225  '',
227  )
228  ) {
229  return $this->__raiseError('Check access failed. ' . USER_FOLDER_ID, 'Server');
230  }
231 
232  $user_id = ilObjUser::getUserIdByLogin($user_name);
233 
234 
235  return $user_id ? $user_id : "0";
236  }
static getUserIdByLogin($a_login)
const USER_FOLDER_ID
Definition: constants.php:31
__raiseError($a_message, $a_code)
global $DIC
Definition: goto.php:24
initAuth($sid)
Init authentication.
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:

◆ searchUser()

ilSoapUserAdministration::searchUser (   $sid,
  $a_keyfields,
  $query_operator,
  $a_keyvalues,
  $attach_roles,
  $active 
)

return user xml following dtd 3.7

Parameters
String$sidsession id
Stringarray $a_keyfields array of user fieldname, following dtd 3.7
String$queryOperatorany logical operator
Stringarray $a_keyValues values separated by space, at least 3 chars per search term

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

References $data, $DIC, $ilDB, $query, __buildSearchQuery(), ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilSoapAdministration\initAuth(), ilSoapAdministration\initIlias(), and USER_FOLDER_ID.

906  {
907  $this->initAuth($sid);
908  $this->initIlias();
909 
910  if (!$this->__checkSession($sid)) {
911  return $this->__raiseError($this->__getMessage(), $this->__getMessageCode());
912  }
913 
914  global $DIC;
915 
916  $ilDB = $DIC['ilDB'];
917  $access = $DIC->access();
918 
919  if (!$access->checkAccess('read_users', '', USER_FOLDER_ID)) {
920  return $this->__raiseError('Check access failed.', 'Server');
921  }
922  if (!count($a_keyfields)) {
923  $this->__raiseError('At least one keyfield is needed', 'Client');
924  }
925 
926  if (!count($a_keyvalues)) {
927  $this->__raiseError('At least one keyvalue is needed', 'Client');
928  }
929 
930  if (!strcasecmp($query_operator, "and")==0 || !strcasecmp($query_operator, "or") == 0) {
931  $this->__raiseError('Query operator must be either \'and\' or \'or\'', 'Client');
932  }
933 
934 
935  $query = $this->__buildSearchQuery($a_keyfields, $query_operator, $a_keyvalues);
936 
937  $query = "SELECT usr_data.*, usr_pref.value AS language
938  FROM usr_data
939  LEFT JOIN usr_pref
940  ON usr_pref.usr_id = usr_data.usr_id AND usr_pref.keyword = " .
941  $ilDB->quote("language", "text") .
942  " WHERE 1 = 1 " . $query;
943 
944  if (is_numeric($active) && $active > -1) {
945  $query .= " AND active = " . $ilDB->quote($active);
946  }
947 
948  $query .= " ORDER BY usr_data.lastname, usr_data.firstname ";
949 
950  //echo $query;
951 
952  $r = $ilDB->query($query);
953 
954  $data = array();
955 
956  while ($row = $ilDB->fetchAssoc($r)) {
957  $data[] = $row;
958  }
959 
960  include_once './Services/User/classes/class.ilUserXMLWriter.php';
961 
962  $xmlWriter = new ilUserXMLWriter();
963  $xmlWriter->setAttachRoles($attach_roles);
964 
965  $xmlWriter->setObjects($data);
966 
967  if ($xmlWriter->start()) {
968  return $xmlWriter->getXML();
969  }
970  return $this->__raiseError('Error in searchUser', 'Server');
971  }
$data
Definition: storeScorm.php:23
__buildSearchQuery($a_keyfields, $queryOperator, $a_keyvalues)
create search term according to parameters
const USER_FOLDER_ID
Definition: constants.php:31
XML writer class.
__raiseError($a_message, $a_code)
global $DIC
Definition: goto.php:24
$query
initAuth($sid)
Init authentication.
global $ilDB
+ Here is the call graph for this function:

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