ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilSoapUserAdministration Class Reference
+ Inheritance diagram for ilSoapUserAdministration:
+ Collaboration diagram for ilSoapUserAdministration:

Public Member Functions

 ilSoapUserAdministration ()
 
 loginCAS ($client, $PT, $username)
 
 loginLDAP ($client, $username, $password)
 
 loginStudipUser ($sid, $user_id)
 login as user for studip mode More...
 
 logout ($sid)
 
 lookupUser ($sid, $user_name)
 
 getUser ($sid, $user_id)
 
 updatePassword ($sid, $user_id, $new_password)
 
 addUser ($sid, $user_data, $global_role_id)
 
 deleteUser ($sid, $user_id)
 
 __validateUserData (&$user_data, $check_complete=true)
 
 __setUserData (&$user_obj, &$user_data)
 
 __readUserData (&$usr_obj)
 
 __substituteUserData ($user_old, $user_new)
 
 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
 ilSoapAdministration ($use_nusoap=true)
 
 initErrorWriter ()
 Overwrite error handler. More...
 
 __explodeSid ($sid)
 
 __setMessage ($a_str)
 
 __getMessage ()
 
 __appendMessage ($a_str)
 
 __setMessageCode ($a_code)
 
 __getMessageCode ()
 
 initAuth ($sid)
 
 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 1318 of file class.ilSoapUserAdministration.php.

1318 {
1319 global $ilDB;
1320 $query = array();
1321
1322 $allowed_fields = array ("firstname","lastname","email","login","matriculation","institution","department","title","ext_account");
1323
1324 foreach ($a_keyfields as $keyfield)
1325 {
1326 $keyfield = strtolower($keyfield);
1327
1328 if (!in_array($keyfield, $allowed_fields))
1329 continue;
1330
1331 $field_query = array ();
1332 foreach ($a_keyvalues as $keyvalue)
1333 {
1334 if (strlen($keyvalue) >= 3) {
1335 $field_query []= $keyfield." like '%".$keyvalue."%'";
1336 }
1337
1338 }
1339 if (count($field_query))
1340 $query [] = join(" ".strtoupper($queryOperator)." ", $field_query);
1341
1342 }
1343
1344 return count ($query) ? " AND ((". join(") OR (", $query) ."))" : "AND 0";
1345 }
global $ilDB

References $ilDB, and $query.

Referenced by searchUser().

+ Here is the caller graph for this function:

◆ __getImportProtocolAsXML()

ilSoapUserAdministration::__getImportProtocolAsXML (   $a_array)

Create XML ResultSet.

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

1163 {
1164 include_once './webservice/soap/classes/class.ilXMLResultSet.php';
1165 include_once './webservice/soap/classes/class.ilXMLResultSetWriter.php';
1166
1167 $xmlResultSet = new ilXMLResultSet ();
1168 $xmlResultSet->addColumn ("userid");
1169 $xmlResultSet->addColumn ("login");
1170 $xmlResultSet->addColumn ("action");
1171 $xmlResultSet->addColumn ("message");
1172
1173 foreach ($a_array as $username => $messages)
1174 {
1175 foreach ($messages as $message)
1176 {
1177
1178 $xmlRow = new ilXMLResultSetRow ();
1179 $xmlRow->setValue (0, 0);
1180 $xmlRow->setValue (1, $username);
1181 $xmlRow->setValue (2, "");
1182 $xmlRow->setValue (3, $message);
1183
1184 $xmlResultSet->addRow ($xmlRow);
1185 }
1186 }
1187
1188 $xml_writer = new ilXMLResultSetWriter ($xmlResultSet);
1189
1190 if ($xml_writer->start ())
1191 return $xml_writer->getXML();
1192
1193 return $this->__raiseError('Error in __getImportProtocolAsXML','Server');
1194 }
__raiseError($a_message, $a_code)
XML Writer for XMLResultSet.
$messages
Definition: en-x-test.php:7

References $messages, and ilSoapAdministration\__raiseError().

Referenced by importUsers().

+ 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 1202 of file class.ilSoapUserAdministration.php.

1203 {
1204 include_once './webservice/soap/classes/class.ilXMLResultSet.php';
1205 include_once './webservice/soap/classes/class.ilXMLResultSetWriter.php';
1206
1207 $xmlResultSet = new ilXMLResultSet ();
1208 $xmlResultSet->addColumn ("userid");
1209 $xmlResultSet->addColumn ("login");
1210 $xmlResultSet->addColumn ("action");
1211 $xmlResultSet->addColumn ("message");
1212
1213 if (count($a_array))
1214 foreach ($a_array as $username => $message)
1215 {
1216 $xmlRow = new ilXMLResultSetRow ();
1217 $xmlRow->setValue (0, $username);
1218 $xmlRow->setValue (1, $message["login"]);
1219 $xmlRow->setValue (2, $message["action"]);
1220 $xmlRow->setValue (3, $message["message"]);
1221
1222 $xmlResultSet->addRow ($xmlRow);
1223 }
1224
1225 $xml_writer = new ilXMLResultSetWriter ( $xmlResultSet);
1226
1227 if ($xml_writer->start ())
1228 return $xml_writer->getXML();
1229
1230 return $this->__raiseError('Error in __getUserMappingAsXML','Server');
1231
1232 }

References ilSoapAdministration\__raiseError().

Referenced by importUsers().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __readUserData()

ilSoapUserAdministration::__readUserData ( $usr_obj)

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

661 {
662 $usr_data['usr_id'] = $usr_obj->getId();
663 $usr_data['login'] = $usr_obj->getLogin();
664 $usr_data['passwd'] = $usr_obj->getPasswd();
665 $usr_data['passwd_type'] = $usr_obj->getPasswdType();
666 $usr_data['firstname'] = $usr_obj->getFirstname();
667 $usr_data['lastname'] = $usr_obj->getLastname();
668 $usr_data['title'] = $usr_obj->getUTitle();
669 $usr_data['gender'] = $usr_obj->getGender();
670 $usr_data['email'] = $usr_obj->getEmail();
671 $usr_data['institution'] = $usr_obj->getInstitution();
672 $usr_data['street'] = $usr_obj->getStreet();
673 $usr_data['city'] = $usr_obj->getCity();
674 $usr_data['zipcode'] = $usr_obj->getZipcode();
675 $usr_data['country'] = $usr_obj->getCountry();
676 $usr_data['phone_office'] = $usr_obj->getPhoneOffice();
677 $usr_data['last_login'] = $usr_obj->getLastLogin();
678 $usr_data['last_update'] = $usr_obj->getLastUpdate();
679 $usr_data['create_date'] = $usr_obj->getCreateDate();
680 $usr_data['hobby'] = $usr_obj->getHobby();
681 $usr_data['department'] = $usr_obj->getDepartment();
682 $usr_data['phone_home'] = $usr_obj->getPhoneHome();
683 $usr_data['phone_mobile'] = $usr_obj->getPhoneMobile();
684 $usr_data['fax'] = $usr_obj->getFax();
685 $usr_data['time_limit_owner'] = $usr_obj->getTimeLimitOwner();
686 $usr_data['time_limit_unlimited'] = $usr_obj->getTimeLimitUnlimited();
687 $usr_data['time_limit_from'] = $usr_obj->getTimeLimitFrom();
688 $usr_data['time_limit_until'] = $usr_obj->getTimeLimitUntil();
689 $usr_data['time_limit_message'] = $usr_obj->getTimeLimitMessage();
690 $usr_data['referral_comment'] = $usr_obj->getComment();
691 $usr_data['matriculation'] = $usr_obj->getMatriculation();
692 $usr_data['active'] = $usr_obj->getActive();
693 $usr_data['approve_date'] = $usr_obj->getApproveDate();
694 $usr_data['user_skin'] = $usr_obj->getPref('skin');
695 $usr_data['user_style'] = $usr_obj->getPref('style');
696 $usr_data['user_language'] = $usr_obj->getLanguage();
697 $usr_data['auth_mode'] = $usr_obj->getAuthMode();
698 $usr_data['accepted_agreement'] = !$usr_obj->hasToAcceptTermsOfService();
699 $usr_data['import_id'] = $usr_obj->getImportId();
700
701 return $usr_data;
702 }

Referenced by getUser().

+ Here is the caller graph for this function:

◆ __setUserData()

ilSoapUserAdministration::__setUserData ( $user_obj,
$user_data 
)

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

615 {
616 // Default to unlimited if no access period is given
617 if(!$user_data['time_limit_from'] and
618 !$user_data['time_limit_until'] and
619 !$user_data['time_limit_unlimited'])
620 {
621 $user_data['time_limit_unlimited'] = 1;
622 }
623 if(!$user_data['time_limit_owner'])
624 {
625 $user_data['time_limit_owner'] = USER_FOLDER_ID;
626 }
627
628
629 // not supported fields by update/addUser
630 $user_data['im_icq'] = $user_obj->getInstantMessengerId('icq');
631 $user_data['im_yahoo'] = $user_obj->getInstantMessengerId('yahoo');
632 $user_data['im_msn'] = $user_obj->getInstantMessengerId('msn');
633 $user_data['im_aim'] = $user_obj->getInstantMessengerId('aim');
634 $user_data['im_skype'] = $user_obj->getInstantMessengerId('skype');
635 $user_data['im_jabber'] = $user_obj->getInstantMessengerId('jabber');
636 $user_data['im_voip'] = $user_obj->getInstantMessengerId('voip');
637
638 $user_data['delicious'] = $user_obj->getDelicious();
639 $user_data['latitude'] = $user_obj->getLatitude();
640 $user_data['longitude'] = $user_obj->getLongitude();
641 $user_data['loc_zoom'] = $user_obj->getLocationZoom();
642
643
644 $user_data['auth_mode'] = $user_obj->getAuthMode();
645 $user_data['ext_account'] = $user_obj->getExternalAccount();
646 $user_obj->assignData($user_data);
647
648 if(isset($user_data['user_language']))
649 {
650 $user_obj->setLanguage($user_data['user_language']);
651 }
652 if(isset($user_data['user_skin']) and isset($user_data['user_style']))
653 {
654 $user_obj->setPref('skin',$user_data['user_skin']);
655 $user_obj->setPref('style',$user_data['user_style']);
656 }
657 return true;
658 }
const USER_FOLDER_ID
Class ilObjUserFolder.

References USER_FOLDER_ID.

Referenced by addUser().

+ Here is the caller graph for this function:

◆ __substituteUserData()

ilSoapUserAdministration::__substituteUserData (   $user_old,
  $user_new 
)

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

705 {
706 foreach($user_new as $key => $value)
707 {
708 $user_old[$key] = $value;
709 }
710 return $user_old ? $user_old : array();
711 }

◆ __validateUserData()

ilSoapUserAdministration::__validateUserData ( $user_data,
  $check_complete = true 
)

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

476 {
477 global $lng,$styleDefinition,$ilLog;
478
479 $this->__setMessage('');
480
481 include_once('./Services/Authentication/classes/class.ilAuthUtils.php');
482 $allow_empty_password = ilAuthUtils::_needsExternalAccountByAuthMode(
483 ilAuthUtils::_getAuthMode($user_data['auth_mode']));
484
485 if($check_complete)
486 {
487 if(!isset($user_data['login']))
488 {
489 $this->__appendMessage('No login given.');
490 }
491 if(!isset($user_data['passwd']) and !$allow_empty_password)
492 {
493 $this->__appendMessage('No password given.');
494 }
495 if(!isset($user_data['email']))
496 {
497 $this->__appendMessage('No email given');
498 }
499 if(!isset($user_data['user_language']))
500 {
501 $user_data['user_language'] = $lng->getDefaultLanguage();
502 }
503 }
504 foreach($user_data as $field => $value)
505 {
506 switch($field)
507 {
508 case 'login':
509 if (!ilUtil::isLogin($value))
510 {
511 $this->__appendMessage('Login invalid.');
512 }
513
514 // check loginname
515 if($check_complete)
516 {
517 if (ilObjUser::_loginExists($value))
518 {
519 $this->__appendMessage('Login already exists.');
520 }
521 }
522 break;
523
524 case 'passwd':
525 if(!strlen($value) and $allow_empty_password)
526 {
527 break;
528 }
529 if (!ilUtil::isPassword($value))
530 {
531 $this->__appendMessage('Password invalid.');
532 }
533 break;
534
535 case 'email':
536 if(!ilUtil::is_email($value))
537 {
538 $this->__appendMessage('Email invalid.');
539 }
540 break;
541
542 case 'time_limit_unlimited':
543 if($value != 1)
544 {
545 if($user_data['time_limit_from'] >= $user_data['time_limit_until'])
546 {
547 $this->__appendMessage('Time limit invalid');
548 }
549 }
550 break;
551
552 case 'user_language':
553 $lang_inst = $lng->getInstalledLanguages();
554
555 if(!in_array($user_data['user_language'],$lang_inst))
556 {
557 $this->__appendMessage('Language: '.$user_data['user_language'].' is not installed');
558 }
559 break;
560
561
562 case 'user_skin':
563 case 'user_style':
564 if(($user_data['user_skin'] and !$user_data['user_style']) or
565 (!$user_data['user_skin'] and $user_data['user_style']))
566 {
567 $this->__appendMessage('user_skin, user_style not valid.');
568 }
569 elseif($user_data['user_skin'] and $user_data['user_style'])
570 {
571 $ok = false;
572 $templates = $styleDefinition->getAllTemplates();
573 if (count($templates) > 0 && is_array($templates))
574 {
575 foreach($templates as $template)
576 {
577 $styleDef =& new ilStyleDefinition($template["id"]);
578 $styleDef->startParsing();
579 $styles = $styleDef->getStyles();
580 foreach ($styles as $style)
581 {
582 if ($user_data['user_skin'] == $template["id"] &&
583 $user_data['user_style'] == $style["id"])
584 {
585 $ok = true;
586 }
587 }
588 }
589 if(!$ok)
590 {
591 $this->__appendMessage('user_skin, user_style not valid.');
592 }
593 }
594 }
595 break;
596
597 case 'time_limit_owner':
598 $type = ilObject::_lookupType($user_data['time_limit_owner'],true);
599 if($type != 'cat' and $type != 'usrf')
600 {
601 $this->__appendMessage('time_limit_owner must be ref_id of category or user folder'.$type);
602 }
603 break;
604
605
606
607 default:
608 continue;
609 }
610 }
611 return strlen($this->__getMessage()) ? false : true;
612 }
_getAuthMode($a_auth_mode, $a_db_handler='')
static _needsExternalAccountByAuthMode($a_auth_mode)
Check if chosen auth mode needs an external account entry.
static _loginExists($a_login, $a_user_id=0)
check if a login name already exists You may exclude a user from the check by giving his user id as 2...
static _lookupType($a_id, $a_reference=false)
lookup object type
parses the template.xml that defines all styles of the current template
static is_email($a_email)
This preg-based function checks whether an e-mail address is formally valid.
isLogin($a_login)
static isPassword($a_passwd, &$customError=null)
validates a password @access public
$style
Definition: example_012.php:70
global $lng
Definition: privfeed.php:40

References $ilLog, $lng, $ok, $style, ilSoapAdministration\__appendMessage(), ilSoapAdministration\__getMessage(), ilSoapAdministration\__setMessage(), ilAuthUtils\_getAuthMode(), ilObjUser\_loginExists(), ilObject\_lookupType(), ilAuthUtils\_needsExternalAccountByAuthMode(), ilUtil\is_email(), ilUtil\isLogin(), and ilUtil\isPassword().

Referenced by addUser().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addUser()

ilSoapUserAdministration::addUser (   $sid,
  $user_data,
  $global_role_id 
)
Deprecated:

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

342 {
343 $this->initAuth($sid);
344 $this->initIlias();
345
346 if(!$this->__checkSession($sid))
347 {
348 return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
349 }
350
351 global $rbacsystem, $rbacreview, $ilLog, $rbacadmin,$ilSetting;
352
353 if(!$rbacsystem->checkAccess('create_usr',USER_FOLDER_ID))
354 {
355 return $this->__raiseError('Check access failed.','Server');
356 }
357
358 // Validate user_data
359 if(!$this->__validateUserData($user_data))
360 {
361 return $this->__raiseError($this->__getMessage(),'Client');
362 }
363 // Validate global role
364 if(!$global_role_id)
365 {
366 return $this->__raiseError('No role id given','Client');
367 }
368
369 // Validate global role
370
371 $global_roles = $rbacreview->getGlobalRoles();
372
373 if(!in_array($global_role_id,$global_roles))
374 {
375 return $this->__raiseError('Role with id: '.$global_role_id.' is not a valid global role','Client');
376 }
377
378 $new_user =& new ilObjUser();
379
380 if(strlen($user_data['passwd']) != 32)
381 {
382 $user_data['passwd_type'] = IL_PASSWD_PLAIN;
383 }
384 else
385 {
386 $user_data['passwd_type'] = IL_PASSWD_CRYPTED;
387 }
388 $this->__setUserData($new_user,$user_data);
389
390 $ilLog->write('SOAP: addUser()');
391
392 // Need this for entry in object_data
393 $new_user->setTitle($new_user->getFullname());
394 $new_user->setDescription($new_user->getEmail());
395
396 if ($user_data["import_id"] != "")
397 {
398 $new_user->setImportId($user_data["import_id"]);
399 }
400
401 $new_user->create();
402
403
404 $new_user->saveAsNew();
405
406 // If agreement is given. Set user agreement accepted.
407 if($user_data['accepted_agreement'])
408 {
409 $new_user->writeAccepted();
410 }
411
412 // Assign role
413 $rbacadmin->assignUser($global_role_id,$new_user->getId());
414
415 // Assign user prefs
416 $new_user->setLanguage($user_data['user_language']);
417 $new_user->setPref('style',$user_data['user_style']);
418 $new_user->setPref('skin',$user_data['user_skin']);
419 $new_user->setPref('hits_per_page',$ilSetting->get('hits_per_page'));
420 $new_user->setPref('show_users_online',$ilSetting->get('show_users_online'));
421 $new_user->writePrefs();
422
423 return $new_user->getId();
424 }
const IL_PASSWD_PLAIN
const IL_PASSWD_CRYPTED
__validateUserData(&$user_data, $check_complete=true)
$new_user
global $ilSetting
Definition: privfeed.php:40

References $ilLog, $ilSetting, $new_user, ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), __setUserData(), __validateUserData(), IL_PASSWD_CRYPTED, IL_PASSWD_PLAIN, ilSoapAdministration\initAuth(), ilSoapAdministration\initIlias(), and USER_FOLDER_ID.

+ Here is the call graph for this function:

◆ deleteUser()

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

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

430 {
431 $this->initAuth($sid);
432 $this->initIlias();
433
434 if(!$this->__checkSession($sid))
435 {
436 return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
437 }
438
439 if(!isset($user_id))
440 {
441 return $this->__raiseError('No user_id given. Aborting','Client');
442 }
443
444 global $rbacsystem, $ilUser, $log;
445
446 if(!$rbacsystem->checkAccess('delete',USER_FOLDER_ID))
447 {
448 return $this->__raiseError('Check access failed.','Server');
449 }
450
451 if(!$ilUser->getLoginByUserId($user_id))
452 {
453 return $this->__raiseError('User id: '.$user_id.' is not a valid identifier. Aborting','Client');
454 }
455 if($ilUser->getId() == $user_id)
456 {
457 return $this->__raiseError('Cannot delete myself. Aborting','Client');
458 }
459 if($user_id == SYSTEM_USER_ID)
460 {
461 return $this->__raiseError('Cannot delete root account. Aborting','Client');
462 }
463 // Delete him
464 $log->write('SOAP: deleteUser()');
465 $delete_user =& ilObjectFactory::getInstanceByObjId($user_id,false);
466 $delete_user->delete();
467
468 return true;
469 }
getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
global $ilUser
Definition: imgupload.php:15

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

+ Here is the call graph for this function:

◆ getUser()

ilSoapUserAdministration::getUser (   $sid,
  $user_id 
)

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

225 {
226 $this->initAuth($sid);
227 $this->initIlias();
228
229 if(!$this->__checkSession($sid))
230 {
231 return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
232 }
233
234 global $rbacsystem, $ilUser;
235
236 if(!$rbacsystem->checkAccess('read',USER_FOLDER_ID))
237 {
238 return $this->__raiseError('Check access failed.','Server');
239 }
240
241 if($ilUser->getLoginByUserId($user_id))
242 {
243 $tmp_user =& ilObjectFactory::getInstanceByObjId($user_id);
244 $usr_data = $this->__readUserData($tmp_user);
245
246 return $usr_data;
247 }
248 return $this->__raiseError('User does not exist','Client');
249 }

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

+ 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 1098 of file class.ilSoapUserAdministration.php.

1099 {
1100 $this->initAuth($sid);
1101 $this->initIlias();
1102
1103 if(!$this->__checkSession($sid))
1104 {
1105 return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
1106 }
1107
1108 include_once './Services/AccessControl/classes/class.ilObjRole.php';
1109 global $ilDB, $rbacreview, $rbacsystem, $tree,$ilUser;
1110
1111
1112 $global_roles = $rbacreview->getGlobalRoles();
1113
1114
1115 if (in_array($role_id, $global_roles))
1116 {
1117 if ($role_id == SYSTEM_ROLE_ID && ! in_array(SYSTEM_ROLE_ID, $rbacreview->assignedRoles($ilUser->getId()))
1118 )
1119 {
1120 return $this->__raiseError("Role access not permitted. ($role_id)","Server");
1121 }
1122 }
1123 else
1124 {
1125 $rolf = $rbacreview->getFoldersAssignedToRole($role_id,true);
1126 if ($rbacreview->isDeleted($rolf[0])
1127 || ! $rbacsystem->checkAccess('write',$rolf[0]))
1128 {
1129 return $this->__raiseError("Role access not permitted. ($role_id)","Server");
1130 }
1131 include_once('Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
1133 if(!$rbacsystem->checkAccess('read',SYSTEM_USER_ID) and
1134 !$rbacsystem->checkAccess('export_member_data',$privacy->getPrivacySettingsRefId())) {
1135 return $this->__raiseError("Export of local role members not permitted. ($role_id)","Server");
1136 }
1137
1138
1139 }
1140
1141 $data = ilObjUser::_getUsersForRole($role_id, $active);
1142 include_once './Services/User/classes/class.ilUserXMLWriter.php';
1143
1144 $xmlWriter = new ilUserXMLWriter();
1145 $xmlWriter->setAttachRoles($attachRoles);
1146
1147 $xmlWriter->setObjects($data);
1148
1149 if($xmlWriter->start())
1150 {
1151 return $xmlWriter->getXML();
1152 }
1153 return $this->__raiseError('Error in getUsersForRole','Server');
1154 }
static _getUsersForRole($role_id, $active=-1)
return array of complete users which belong to a specific role
static _getInstance()
Get instance of ilPrivacySettings.
XML writer class.
$data

References $data, $ilDB, $ilUser, ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilPrivacySettings\_getInstance(), ilObjUser\_getUsersForRole(), ilSoapAdministration\initAuth(), and ilSoapAdministration\initIlias().

+ Here is the call graph for this function:

◆ getUserIdBySid()

ilSoapUserAdministration::getUserIdBySid (   $sid)

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

1432 {
1433 $this->initAuth($sid);
1434 $this->initIlias();
1435
1436 if(!$this->__checkSession($sid))
1437 {
1438 return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
1439 }
1440
1441 global $ilDB;
1442
1443 $parts = explode('::', $sid);
1444 $query = "SELECT usr_id FROM usr_session "
1445 . "INNER JOIN usr_data ON usr_id = user_id WHERE session_id = %s";
1446 $res = $ilDB->queryF($query, array('text'), array($parts[0]));
1447 $data = $ilDB->fetchAssoc($res);
1448
1449 if(!(int)$data['usr_id'])
1450 {
1451 $this->__raiseError('User does not exist', 'Client');
1452 }
1453
1454 return (int)$data['usr_id'];
1455 }

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

+ 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 1020 of file class.ilSoapUserAdministration.php.

1021 {
1022 $this->initAuth($sid);
1023 $this->initIlias();
1024
1025 if(!$this->__checkSession($sid))
1026 {
1027 return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
1028 }
1029
1030 global $ilDB, $tree, $rbacreview, $rbacsystem;
1031
1032 if ($ref_id == -1)
1034
1035 $object = $this->checkObjectAccess($ref_id, array("crs","cat","grp","usrf","sess"), "read", true);
1036 if ($this->isFault($object))
1037 return $object;
1038
1039 $data = array();
1040 switch ($object->getType()) {
1041 case "usrf":
1043 break;
1044 case "cat":
1046 break;
1047 case "crs":
1048 {
1049 // GET ALL MEMBERS
1050 $roles = $object->__getLocalRoles();
1051
1052 foreach($roles as $role_id)
1053 {
1054 $data = array_merge($rbacreview->assignedUsers($role_id, array()),$data);
1055 }
1056
1057 break;
1058 }
1059 case "grp":
1060 $member_ids = $object->getGroupMemberIds();
1061 $data = ilObjUser::_getUsersForGroup($member_ids, $active);
1062 break;
1063 case "sess":
1064 $course_ref_id = $tree->checkForParentType($ref_id,'crs');
1065 if(!$course_ref_id)
1066 {
1067 return $this->__raiseError("No course for session", "Client");
1068 }
1069
1070 $event_obj_id = ilObject::_lookupObjId($ref_id);
1071 include_once 'Modules/Session/classes/class.ilEventParticipants.php';
1072 $event_part = new ilEventParticipants($event_obj_id);
1073 $member_ids = array_keys($event_part->getParticipants());
1074 $data = ilObjUser::_getUsersForIds($member_ids, $active);
1075 break;
1076 }
1077
1078 if (is_array($data))
1079 {
1080 include_once './Services/User/classes/class.ilUserXMLWriter.php';
1081
1082 $xmlWriter = new ilUserXMLWriter();
1083 $xmlWriter->setObjects($data);
1084 $xmlWriter->setAttachRoles ($attachRoles);
1085
1086 if($xmlWriter->start())
1087 {
1088 return $xmlWriter->getXML();
1089 }
1090 }
1091 return $this->__raiseError('Error in processing information. This is likely a bug.','Server');
1092 }
static _getUsersForIds($a_mem_ids, $active=-1, $timelimitowner=-1)
return user data for given user id
static _getUsersForFolder($ref_id, $active)
static _getUsersForGroup($a_mem_ids, $active=-1)
return user data for group members
static _lookupObjId($a_id)
checkObjectAccess($ref_id, $expected_type, $permission, $returnObject=false)
check access for ref id: expected type, permission, return object instance if returnobject is true
$ref_id
Definition: sahs_server.php:39

References $data, $ilDB, $ref_id, 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.

+ 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 1355 of file class.ilSoapUserAdministration.php.

1356 {
1357 $this->initAuth($sid);
1358 $this->initIlias();
1359
1360 if(!$this->__checkSession($sid))
1361 {
1362 return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
1363 }
1364
1365 global $rbacsystem, $ilUser, $ilDB;
1366
1367 // check if own account
1368 $is_self = false;
1369 if(is_array($a_user_ids) and count($a_user_ids) == 1)
1370 {
1371 if(end($a_user_ids) == $ilUser->getId())
1372 {
1373 $is_self = true;
1374 }
1375 }
1376 elseif(is_numeric($a_user_ids))
1377 {
1378 if($a_user_ids == $ilUser->getId())
1379 {
1380 $is_self = true;
1381 }
1382 }
1383
1384 if(!$rbacsystem->checkAccess('read',USER_FOLDER_ID) and !$is_self)
1385 {
1386 return $this->__raiseError('Check access failed.','Server');
1387 }
1388
1389 // begin-patch filemanager
1390 $data = ilObjUser::_getUserData((array) $a_user_ids);
1391 // end-patch filemanager
1392
1393 include_once './Services/User/classes/class.ilUserXMLWriter.php';
1394 $xmlWriter = new ilUserXMLWriter();
1395 $xmlWriter->setAttachRoles($attach_roles);
1396 $xmlWriter->setObjects($data);
1397
1398 if($xmlWriter->start())
1399 {
1400 return $xmlWriter->getXML();
1401 }
1402
1403 return $this->__raiseError('User does not exist','Client');
1404 }
static _getUserData($a_internalids)
return user data for given user ids

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

+ Here is the call graph for this function:

◆ hasNewMail()

ilSoapUserAdministration::hasNewMail (   $sid)

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

1409 {
1410 $this->initAuth($sid);
1411 $this->initIlias();
1412
1413 if(!$this->__checkSession($sid))
1414 {
1415 return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
1416 }
1417
1418 global $ilUser;
1419
1420 include_once 'Services/Mail/classes/class.ilMailGlobalServices.php';
1422 {
1423 return true;
1424 }
1425 else
1426 {
1427 return false;
1428 }
1429 }
static getNumberOfNewMailsByUserId($usr_id)
Determines the number of new mails for the passed user id and stores this information in a local cach...

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

+ Here is the call graph for this function:

◆ ilSoapUserAdministration()

ilSoapUserAdministration::ilSoapUserAdministration ( )

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

38 {
39 parent::ilSoapAdministration();
40 }

◆ 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 719 of file class.ilSoapUserAdministration.php.

720 {
721 $this->initAuth($sid);
722 $this->initIlias();
723
724 if(!$this->__checkSession($sid))
725 {
726 return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
727 }
728
729
730 include_once './Services/User/classes/class.ilUserImportParser.php';
731 include_once './Services/AccessControl/classes/class.ilObjRole.php';
732 include_once './Services/Object/classes/class.ilObjectFactory.php';
733 global $rbacreview, $rbacsystem, $tree, $lng,$ilUser,$ilLog;
734
735 // this takes time but is nescessary
736 $error = false;
737
738
739 // validate to prevent wrong XMLs
740 $this->dom = @domxml_open_mem($usr_xml, DOMXML_LOAD_VALIDATING, $error);
741 if ($error)
742 {
743 $msg = array();
744 if (is_array($error))
745 {
746 foreach ($error as $err) {
747 $msg []= "(".$err["line"].",".$err["col"]."): ".$err["errormessage"];
748 }
749 }
750 else
751 {
752 $msg[] = $error;
753 }
754 $msg = join("\n",$msg);
755 return $this->__raiseError($msg, "Client");
756 }
757
758
759 switch ($conflict_rule)
760 {
761 case 2:
762 $conflict_rule = IL_UPDATE_ON_CONFLICT;
763 break;
764 case 3:
765 $conflict_rule = IL_IGNORE_ON_CONFLICT;
766 break;
767 default:
768 $conflict_rule = IL_FAIL_ON_CONFLICT;
769 }
770
771
772 // folder id 0, means to check permission on user basis!
773 // must have create user right in time_limit_owner property (which is ref_id of container)
774 if ($folder_id != 0)
775 {
776 // determine where to import
777 if ($folder_id == -1)
778 $folder_id = USER_FOLDER_ID;
779
780 // get folder
781 $import_folder = ilObjectFactory::getInstanceByRefId($folder_id, false);
782 // id does not exist
783 if (!$import_folder)
784 return $this->__raiseError('Wrong reference id.','Server');
785
786 // folder is not a folder, can also be a category
787 if ($import_folder->getType() != "usrf" && $import_folder->getType() != "cat")
788 return $this->__raiseError('Folder must be a usr folder or a category.','Server');
789
790 // check access to folder
791 if(!$rbacsystem->checkAccess('create_usr',$folder_id))
792 {
793 return $this->__raiseError('Missing permission for creating users within '.$import_folder->getTitle(),'Server');
794 }
795 }
796
797 // first verify
798
799
800 $importParser = new ilUserImportParser("", IL_VERIFY, $conflict_rule);
801 $importParser->setUserMappingMode(IL_USER_MAPPING_ID);
802 $importParser->setXMLContent($usr_xml);
803 $importParser->startParsing();
804
805 switch ($importParser->getErrorLevel())
806 {
807 case IL_IMPORT_SUCCESS :
808 break;
809 case IL_IMPORT_WARNING :
810 return $this->__getImportProtocolAsXML ($importParser->getProtocol("User Import Log - Warning"));
811 break;
812 case IL_IMPORT_FAILURE :
813 return $this->__getImportProtocolAsXML ($importParser->getProtocol("User Import Log - Failure"));
814 }
815
816 // verify is ok, so get role assignments
817
818 $importParser = new ilUserImportParser("", IL_EXTRACT_ROLES, $conflict_rule);
819 $importParser->setXMLContent($usr_xml);
820 $importParser->setUserMappingMode(IL_USER_MAPPING_ID);
821 $importParser->startParsing();
822
823 $roles = $importParser->getCollectedRoles();
824
825 //print_r($roles);
826
827
828
829 // roles to be assigned, skip if one is not allowed!
830 $permitted_roles = array();
831 foreach ($roles as $role_id => $role)
832 {
833 if (!is_numeric ($role_id))
834 {
835 // check if internal id
836 $internalId = ilUtil::__extractId($role_id, IL_INST_ID);
837
838 if (is_numeric($internalId))
839 {
840 $role_id = $internalId;
841 $role_name = $role_id;
842 }
843/* else // perhaps it is a rolename
844 {
845 $role = ilSoapUserAdministration::__getRoleForRolename ($role_id);
846 $role_name = $role->title;
847 $role_id = $role->role_id;
848 }*/
849 }
850
851 if($this->isPermittedRole($folder_id,$role_id))
852 {
853 $permitted_roles[$role_id] = $role_id;
854 }
855 else
856 {
857 $role_name = ilObject::_lookupTitle($role_id);
858 return $this->__raiseError("Could not find role ".$role_name.". Either you use an invalid/deleted role ".
859 "or you try to assign a local role into the non-standard user folder and this role is not in its subtree.",'Server');
860 }
861 }
862
863 $global_roles = $rbacreview->getGlobalRoles();
864
865 //print_r ($global_roles);
866
867
868
869 foreach ($permitted_roles as $role_id => $role_name)
870 {
871 if ($role_id != "")
872 {
873 if (in_array($role_id, $global_roles))
874 {
875 if ($role_id == SYSTEM_ROLE_ID && ! in_array(SYSTEM_ROLE_ID,$rbacreview->assignedRoles($ilUser->getId()))
876 || ($folder_id != USER_FOLDER_ID && $folder_id != 0 && ! ilObjRole::_getAssignUsersStatus($role_id))
877 )
878 {
879 return $this->__raiseError($lng->txt("usrimport_with_specified_role_not_permitted")." $role_name ($role_id)",'Server');
880 }
881 }
882 else
883 {
884 $rolf = $rbacreview->getFoldersAssignedToRole($role_id,true);
885 if ($rbacreview->isDeleted($rolf[0])
886 || ! $rbacsystem->checkAccess('write',$rolf[0]))
887 {
888
889 return $this->__raiseError($lng->txt("usrimport_with_specified_role_not_permitted")." $role_name ($role_id)","Server");
890 }
891 }
892 }
893 }
894
895 //print_r ($permitted_roles);
896
897 $importParser = new ilUserImportParser("", IL_USER_IMPORT, $conflict_rule);
898 $importParser->setSendMail($send_account_mail);
899 $importParser->setUserMappingMode(IL_USER_MAPPING_ID);
900 $importParser->setFolderId($folder_id);
901 $importParser->setXMLContent($usr_xml);
902
903 $importParser->setRoleAssignment($permitted_roles);
904
905 $importParser->startParsing();
906
907 if ($importParser->getErrorLevel() != IL_IMPORT_FAILURE)
908 {
909 return $this->__getUserMappingAsXML ($importParser->getUserMapping());
910 }
911 return $this->__getImportProtocolAsXML ($importParser->getProtocol());
912
913 }
const IL_FAIL_ON_CONFLICT
const IL_USER_MAPPING_ID
const IL_IMPORT_FAILURE
const IL_UPDATE_ON_CONFLICT
const IL_EXTRACT_ROLES
const IL_IMPORT_SUCCESS
const IL_USER_IMPORT
const IL_VERIFY
const IL_IGNORE_ON_CONFLICT
const IL_IMPORT_WARNING
_getAssignUsersStatus($a_role_id)
getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
static _lookupTitle($a_id)
lookup object title
__getImportProtocolAsXML($a_array)
Create XML ResultSet.
isPermittedRole($a_folder, $a_role)
check if assignment is allowed
__getUserMappingAsXML($a_array)
return user mapping as xml
static __extractId($ilias_id, $inst_id)
extract ref id from role title, e.g.
const DOMXML_LOAD_VALIDATING
domxml_open_mem($str, $mode=DOMXML_LOAD_PARSING, &$error=NULL)

References $ilLog, $ilUser, $lng, ilUtil\__extractId(), __getImportProtocolAsXML(), ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), __getUserMappingAsXML(), ilSoapAdministration\__raiseError(), ilObjRole\_getAssignUsersStatus(), ilObject\_lookupTitle(), DOMXML_LOAD_VALIDATING, 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_UPDATE_ON_CONFLICT, IL_USER_IMPORT, IL_USER_MAPPING_ID, IL_VERIFY, ilSoapAdministration\initAuth(), ilSoapAdministration\initIlias(), isPermittedRole(), and USER_FOLDER_ID.

+ Here is the call graph for this function:

◆ isPermittedRole()

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

check if assignment is allowed

@access protected

Parameters

return

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

923 {
924 static $checked_roles = array();
925 static $global_roles = null;
926
927
928 if(isset($checked_roles[$a_role]))
929 {
930 return $checked_roles[$a_role];
931 }
932
933 global $rbacsystem,$rbacreview,$ilUser,$tree,$ilLog;
934
935 $locations = $rbacreview->getFoldersAssignedToRole($a_role,true);
936 $location = $locations[0];
937
938 // global role
939 if($location == ROLE_FOLDER_ID)
940 {
941 $ilLog->write(__METHOD__.': Check global role');
942 // check assignment permission if called from local admin
943
944
945 if($a_folder != USER_FOLDER_ID and $a_folder != 0)
946 {
947 $ilLog->write(__METHOD__.': '.$a_folder);
948 include_once './Services/AccessControl/classes/class.ilObjRole.php';
950 {
951 $ilLog->write(__METHOD__.': No assignment allowed');
952 $checked_roles[$a_role] = false;
953 return false;
954 }
955 }
956 // exclude anonymous role from list
957 if ($a_role == ANONYMOUS_ROLE_ID)
958 {
959 $ilLog->write(__METHOD__.': Anonymous role chosen.');
960 $checked_roles[$a_role] = false;
961 return false;
962 }
963 // do not allow to assign users to administrator role if current user does not has SYSTEM_ROLE_ID
964 if($a_role == SYSTEM_ROLE_ID and !in_array(SYSTEM_ROLE_ID,$rbacreview->assignedRoles($ilUser->getId())))
965 {
966 $ilLog->write(__METHOD__.': System role assignment forbidden.');
967 $checked_roles[$a_role] = false;
968 return false;
969 }
970
971 // Global role assignment ok
972 $ilLog->write(__METHOD__.': Assignment allowed.');
973 $checked_roles[$a_role] = true;
974 return true;
975 }
976 elseif($location)
977 {
978 $ilLog->write(__METHOD__.': Check local role.');
979
980 // It's a local role
981 $rolfs = $rbacreview->getFoldersAssignedToRole($a_role,true);
982 $rolf = $rolfs[0];
983
984
985 // only process role folders that are not set to status "deleted"
986 // and for which the user has write permissions.
987 // We also don't show the roles which are in the ROLE_FOLDER_ID folder.
988 // (The ROLE_FOLDER_ID folder contains the global roles).
989 if($rbacreview->isDeleted($rolf)
990 || !$rbacsystem->checkAccess('edit_permission',$rolf))
991 {
992 $ilLog->write(__METHOD__.': Role deleted or no permission.');
993 $checked_roles[$a_role] = false;
994 return false;
995 }
996 // A local role is only displayed, if it is contained in the subtree of
997 // the localy administrated category. If the import function has been
998 // invoked from the user folder object, we show all local roles, because
999 // the user folder object is considered the parent of all local roles.
1000 // Thus, if we start from the user folder object, we initializ$isInSubtree = $folder_id == USER_FOLDER_ID || $folder_id == 0;e the
1001 // isInSubtree variable with true. In all other cases it is initialized
1002 // with false, and only set to true if we find the object id of the
1003 // locally administrated category in the tree path to the local role.
1004 if($a_folder != USER_FOLDER_ID and $a_folder != 0 and !$tree->isGrandChild($a_folder,$rolf))
1005 {
1006 $ilLog->write(__METHOD__.': Not in path of category.');
1007 $checked_roles[$a_role] = false;
1008 return false;
1009 }
1010 $ilLog->write(__METHOD__.': Assignment allowed.');
1011 $checked_roles[$a_role] = true;
1012 return true;
1013 }
1014 }
$location
Definition: buildRTE.php:44

References $ilLog, $ilUser, $location, ilObjRole\_getAssignUsersStatus(), and USER_FOLDER_ID.

Referenced by importUsers().

+ 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 76 of file class.ilSoapUserAdministration.php.

77 {
79 $this->sauth->setClient($client);
80 $this->sauth->setUsername($username);
81 $this->sauth->setPT($PT);
82 $authenticated = true;
83 //include_once("./Services/CAS/classes/class.ilCASAuth.php");
84 //include_once("./Services/CAS/phpcas/source/CAS/CAS.php");
85 if(!$this->sauth->authenticate())
86 {
87 $authenticated = false;
88 }
89 if(!$authenticated)
90 {
91 return $this->__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
92 }
93 return $this->sauth->getSid().'::'.$client;
94 }
const AUTH_CAS
__initAuthenticationObject($a_auth_mode=AUTH_LOCAL)

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

+ Here is the call graph for this function:

◆ loginLDAP()

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

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

98 {
99 return $this->login($client, $username, $password);
100 }

References $client.

◆ loginStudipUser()

ilSoapUserAdministration::loginStudipUser (   $sid,
  $user_id 
)

login as user for studip mode

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

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

110 {
111 global $rbacreview, $ilUser, $ilIliasIniFile;
112
113 $this->initAuth($sid);
114 $this->initIlias();
115 list($admin_sid,$client) = $this->__explodeSid($sid);
116
117 if(!$this->__checkSession($sid))
118 {
119 return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
120 }
121
122 if (!$ilIliasIniFile->readVariable('server', 'studip'))
123 {
124 return $this->__raiseError('Stud.IP mode not active.','Server');
125 }
126
127 if(!$rbacreview->isAssigned($ilUser->getId(),SYSTEM_ROLE_ID))
128 {
129 return $this->__raiseError('No permission to initialize user session.','Server');
130 }
131
132 if($ilUser->getLoginByUserId($user_id))
133 {
134 $tmp_user =& ilObjectFactory::getInstanceByObjId($user_id);
135
136 global $ilAuth;
137 $ilAuth->logout();
138 session_destroy();
139
140 unset($_COOKIE['PHPSESSID']);
141 $_COOKIE['ilClientId'] = $client;
142 $_POST['username'] = $tmp_user->getLogin();
143 $_POST['password'] = $tmp_user->getPasswd();
144
145 try
146 {
147 require_once("Services/Init/classes/class.ilInitialisation.php");
149 }
150
151 catch(Exception $e)
152 {
153 return $this->__raiseError($e->getMessage(), 'Server');
154 }
155
156 ilUtil::setCookie('ilClientId',$client);
157
158 if($ilUser->hasToAcceptTermsOfService())
159 {
160 return $this->__raiseError('User agreement not accepted', 'Server');
161 }
162
163 return (session_id().'::'.$client);
164 }
165 return $this->__raiseError('User does not exist','Client');
166 }
static setCookie($a_cookie_name, $a_cookie_value='', $a_also_set_super_global=true, $a_set_cookie_invalid=false)
$_POST['username']
Definition: cron.php:12
$_COOKIE["ilClientId"]
Definition: cron.php:11
global $ilIliasIniFile

References $_COOKIE, $_POST, $client, $ilIliasIniFile, $ilUser, ilSoapAdministration\__explodeSid(), ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilObjectFactory\getInstanceByObjId(), ilSoapAdministration\initAuth(), ilSoapAdministration\initIlias(), ilInitialisation\reinitILIAS(), and ilUtil\setCookie().

+ Here is the call graph for this function:

◆ logout()

ilSoapUserAdministration::logout (   $sid)

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

169 {
170 $this->initAuth($sid);
171 $this->initIlias();
172
173 if(!$this->__checkSession($sid))
174 {
175 return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
176 }
177
178 global $ilAuth;
179 $ilAuth->logout();
180 session_destroy();
181 return true;
182
183 /*
184 if(!$this->sauth->logout())
185 {
186 return $this->__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
187 }
188
189 return true;
190 */
191 }

References ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilSoapAdministration\initAuth(), and ilSoapAdministration\initIlias().

+ Here is the call graph for this function:

◆ lookupUser()

ilSoapUserAdministration::lookupUser (   $sid,
  $user_name 
)

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

194 {
195 $this->initAuth($sid);
196 $this->initIlias();
197
198 if(!$this->__checkSession($sid))
199 {
200 return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
201 }
202
203 $user_name = trim($user_name);
204
205 if(!strlen($user_name))
206 {
207 return $this->__raiseError('No username given. Aborting','Client');
208 }
209
210 global $rbacsystem, $ilUser ;
211
212 if(strcasecmp($ilUser->getLogin(), $user_name) != 0 && !$rbacsystem->checkAccess('read',USER_FOLDER_ID))
213 {
214 return $this->__raiseError('Check access failed. '.USER_FOLDER_ID,'Server');
215 }
216
217 $user_id = ilObjUser::getUserIdByLogin($user_name);
218
219
220 return $user_id ? $user_id : "0";
221
222 }
getUserIdByLogin($a_login)

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

+ 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 1242 of file class.ilSoapUserAdministration.php.

1242 {
1243
1244 $this->initAuth($sid);
1245 $this->initIlias();
1246
1247 if(!$this->__checkSession($sid))
1248 {
1249 return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
1250 }
1251
1252 global $ilDB, $rbacsystem;
1253
1254 if(!$rbacsystem->checkAccess('read', USER_FOLDER_ID))
1255 {
1256 return $this->__raiseError('Check access failed.','Server');
1257 }
1258
1259
1260 if (!count($a_keyfields))
1261 $this->__raiseError('At least one keyfield is needed','Client');
1262
1263 if (!count ($a_keyvalues))
1264 $this->__raiseError('At least one keyvalue is needed','Client');
1265
1266 if (!strcasecmp($query_operator,"and")==0 || !strcasecmp($query_operator,"or") == 0)
1267 $this->__raiseError('Query operator must be either \'and\' or \'or\'','Client');
1268
1269
1270 $query = $this->__buildSearchQuery ($a_keyfields, $query_operator, $a_keyvalues);
1271
1272 $query = "SELECT usr_data.*, usr_pref.value AS language
1273 FROM usr_data
1274 LEFT JOIN usr_pref
1275 ON usr_pref.usr_id = usr_data.usr_id AND usr_pref.keyword = ".
1276 $ilDB->quote("language", "text").
1277 "'language'
1278 WHERE 1 = 1 ".$query;
1279
1280 if (is_numeric($active) && $active > -1)
1281 $query .= " AND active = ". $ilDB->quote($active);
1282
1283 $query .= " ORDER BY usr_data.lastname, usr_data.firstname ";
1284
1285 //echo $query;
1286
1287 $r = $ilDB->query($query);
1288
1289 $data = array();
1290
1291 while($row = $ilDB->fetchAssoc($r))
1292 {
1293 $data[] = $row;
1294 }
1295
1296 include_once './Services/User/classes/class.ilUserXMLWriter.php';
1297
1298 $xmlWriter = new ilUserXMLWriter();
1299 $xmlWriter->setAttachRoles($attach_roles);
1300
1301 $xmlWriter->setObjects($data);
1302
1303 if($xmlWriter->start())
1304 {
1305 return $xmlWriter->getXML();
1306 }
1307 return $this->__raiseError('Error in searchUser','Server');
1308 }
__buildSearchQuery($a_keyfields, $queryOperator, $a_keyvalues)
create search term according to parameters
$r
Definition: example_031.php:79

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

+ Here is the call graph for this function:

◆ updatePassword()

ilSoapUserAdministration::updatePassword (   $sid,
  $user_id,
  $new_password 
)
Deprecated:

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

312 {
313 $this->initAuth($sid);
314 $this->initIlias();
315
316 if(!$this->__checkSession($sid))
317 {
318 return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
319 }
320
321 global $rbacsystem;
322
323 if(!$rbacsystem->checkAccess('write',USER_FOLDER_ID))
324 {
325 return $this->__raiseError('Check access failed.','Server');
326 }
327
328 if(!$tmp_user =& ilObjectFactory::getInstanceByObjId($user_id,false))
329 {
330 return $this->__raiseError('No valid user_id given.','Client');
331 }
332
333 $tmp_user->replacePassword($new_password);
334
335 return true;
336 }

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

+ Here is the call graph for this function:

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