33 include_once
'./webservice/soap/classes/class.ilSoapAdministration.php';
47 return $this->
__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
51 include_once
'./include/inc.header.php';
52 global $rbacreview, $rbacsystem,$ilAccess;
56 return $this->
__raiseError(
'No valid role id given. Please choose an existing id of an ILIAS role',
61 $obj_ref = $rbacreview->getObjectOfRole($role_id);
62 if(!$ilAccess->checkAccess(
'edit_permission',
'',$obj_ref))
64 return $this->
__raiseError(
'Check access failed. No permission to delete role',
'Server');
68 foreach($assigned_users = $rbacreview->assignedUsers($role_id) as $user_id)
70 if(count($rbacreview->assignedRoles($user_id)) == 1)
72 return $this->
__raiseError(
'Cannot deassign last role of users',
78 $rolf_id = end($rolf_ids = $rbacreview->getFoldersAssignedToRole($role_id,
true));
79 $tmp_role->setParent($rolf_id);
90 return $this->
__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
94 include_once
'./include/inc.header.php';
96 global $rbacadmin,$rbacreview,$ilAccess;
100 return $this->
__raiseError(
'No valid user id given. Please choose an existing id of an ILIAS user',
105 return $this->
__raiseError(
'No valid role id given. Please choose an existing id of an ILIAS role',
109 $obj_ref = $rbacreview->getObjectOfRole($role_id);
110 if(!$ilAccess->checkAccess(
'edit_permission',
'',$obj_ref))
112 return $this->
__raiseError(
'Check access failed. No permission to assign users',
'Server');
115 if(!$rbacadmin->assignUser($role_id,$user_id))
117 return $this->
__raiseError(
'Error rbacadmin->assignUser()',
126 return $this->
__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
130 include_once
'./include/inc.header.php';
131 global $rbacadmin,$ilAccess,$rbacreview;
135 return $this->
__raiseError(
'No valid user id given. Please choose an existing id of an ILIAS user',
140 return $this->
__raiseError(
'No valid role id given. Please choose an existing id of an ILIAS role',
144 $obj_ref = $rbacreview->getObjectOfRole($role_id);
145 if(!$ilAccess->checkAccess(
'edit_permission',
'',$obj_ref))
147 return $this->
__raiseError(
'Check access failed. No permission to deassign users',
'Server');
150 if(!$rbacadmin->deassignUser($role_id,$user_id))
152 return $this->
__raiseError(
'Error rbacadmin->deassignUser()',
162 return $this->
__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
166 include_once
'./include/inc.header.php';
169 if(is_array($ops = $rbacreview->getOperations()))
183 return $this->
__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
187 include_once
'./include/inc.header.php';
188 global $rbacadmin,$ilAccess;
192 return $this->
__raiseError(
'No valid ref id given. Please choose an existing reference id of an ILIAS object',
197 return $this->
__raiseError(
'No valid role id given. Please choose an existing id of an ILIAS role',
200 if ($role_id == SYSTEM_ROLE_ID)
202 return $this->
__raiseError(
'Cannot revoke permissions of system role',
206 if(!$ilAccess->checkAccess(
'edit_permission',
'',
$ref_id))
208 return $this->
__raiseError(
'Check access failed. No permission to revoke permissions',
'Server');
211 $rbacadmin->revokePermission(
$ref_id,$role_id);
219 return $this->
__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
223 include_once
'./include/inc.header.php';
224 global $rbacadmin,$ilAccess;
228 return $this->
__raiseError(
'No valid ref id given. Please choose an existing reference id of an ILIAS object',
233 return $this->
__raiseError(
'No valid role id given. Please choose an existing id of an ILIAS role',
237 if(!$ilAccess->checkAccess(
'edit_permission',
'',
$ref_id))
239 return $this->
__raiseError(
'Check access failed. No permission to grant permissions',
'Server');
244 if(isset($permissions[
'item']))
246 $permissions = $permissions[
'item'];
249 if(!is_array($permissions))
251 return $this->
__raiseError(
'No valid permissions given.'.print_r($permissions),
255 $rbacadmin->revokePermission(
$ref_id,$role_id);
257 $rbacadmin->grantPermission($role_id,$permissions,
$ref_id);
266 return $this->
__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
270 include_once
'./include/inc.header.php';
271 global $rbacreview,$ilAccess;
275 return $this->
__raiseError(
'No valid ref id given. Please choose an existing reference id of an ILIAS object',
279 if(!$ilAccess->checkAccess(
'edit_permission',
'',
$ref_id))
281 return $this->
__raiseError(
'Check access failed. No permission to access role information',
'Server');
285 $role_folder = $rbacreview->getRoleFolderOfObject(
$ref_id);
287 if(count($role_folder))
289 foreach($rbacreview->getRolesOfRoleFolder($role_folder[
'ref_id'],
false) as $role_id)
299 include_once
'./webservice/soap/classes/class.ilObjectXMLWriter.php';
302 $xml_writer->setObjects($objs);
303 if($xml_writer->start())
305 return $xml_writer->getXML();
315 return $this->
__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
319 include_once
'./include/inc.header.php';
324 return $this->
__raiseError(
'No valid user id given. Please choose an existing id of an ILIAS user',
328 foreach($rbacreview->assignedRoles($user_id) as $role_id)
337 include_once
'./webservice/soap/classes/class.ilObjectXMLWriter.php';
340 $xml_writer->setObjects($objs);
341 if($xml_writer->start())
343 return $xml_writer->getXML();
353 return $this->
__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
357 include_once
'./include/inc.header.php';
358 global $rbacreview, $objDefinition, $rbacsystem,$ilAccess;
362 return $this->
__raiseError(
'No valid ref id given. Please choose an existing reference id of an ILIAS object',
368 return $this->
__raiseError(
"Parent with ID $target_id has been deleted.",
'CLIENT_TARGET_DELETED');
371 if(!$ilAccess->checkAccess(
'edit_permission',
'',
$target_id))
373 return $this->
__raiseError(
'Check access failed. No permission to create roles',
'Server');
376 include_once
'webservice/soap/classes/class.ilObjectXMLParser.php';
379 $xml_parser->startParsing();
381 foreach($xml_parser->getObjectData() as $object_data)
385 if(substr($object_data[
'title'],0,3) ==
"il_")
387 return $this->
__raiseError(
'Rolenames are not allowed to start with "il_" ',
391 $rolf_data = $rbacreview->getRoleFolderOfObject(
$target_id);
392 if (!$rolf_id = $rolf_data[
"child"])
395 $subobjects = $objDefinition->getSubObjects($tmp_obj->getType());
396 if(!isset($subobjects[
"rolf"]))
398 return $this->
__raiseError(
'Cannot create role at this position',
403 if (!$rbacsystem->checkAccess(
'create',
$target_id,
'rolf'))
405 return $this->
__raiseError(
'No permission to create role folders',
410 $rolf_obj = $tmp_obj->createRoleFolder();
411 $rolf_id = $rolf_obj->getRefId();
414 $role_obj = $rolf_obj->createRole($object_data[
'title'],$object_data[
'description'],
415 $object_data[
'import_id']);
417 $new_roles[] = $role_obj->getId();
420 return $new_roles ? $new_roles : array();
427 return $this->
__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
431 include_once
'./include/inc.header.php';
432 global $rbacreview, $objDefinition, $rbacsystem, $rbacadmin,$ilAccess;
436 return $this->
__raiseError(
'No valid ref id given. Please choose an existing reference id of an ILIAS object',
441 return $this->
__raiseError(
'No valid template id given. Please choose an existing object id of an ILIAS role template',
448 return $this->
__raiseError(
"Parent with ID $target_id has been deleted.",
'CLIENT_TARGET_DELETED');
451 if(!$ilAccess->checkAccess(
'edit_permission',
'',
$target_id))
453 return $this->
__raiseError(
'Check access failed. No permission to create roles',
'Server');
457 include_once
'webservice/soap/classes/class.ilObjectXMLParser.php';
460 $xml_parser->startParsing();
462 foreach($xml_parser->getObjectData() as $object_data)
466 if(substr($object_data[
'title'],0,3) ==
"il_")
468 return $this->
__raiseError(
'Rolenames are not allowed to start with "il_" ',
472 $rolf_data = $rbacreview->getRoleFolderOfObject(
$target_id);
473 if (!$rolf_id = $rolf_data[
"child"])
476 $subobjects = $objDefinition->getSubObjects($tmp_obj->getType());
477 if(!isset($subobjects[
"rolf"]))
479 return $this->
__raiseError(
'Cannot create role at this position',
484 if (!$rbacsystem->checkAccess(
'create',
$target_id,
'rolf'))
486 return $this->
__raiseError(
'No permission to create role folders',
491 $rolf_obj = $tmp_obj->createRoleFolder();
492 $rolf_id = $rolf_obj->getRefId();
495 $role_obj = $rolf_obj->createRole($object_data[
'title'],$object_data[
'description']);
498 $rbacadmin->copyRoleTemplatePermissions($template_id,ROLE_FOLDER_ID,$rolf_obj->getRefId(),$role_obj->getId());
501 $ops = $rbacreview->getOperationsOfRole($role_obj->getId(),$tmp_obj->getType(),$rolf_obj->getRefId());
502 $rbacadmin->grantPermission($role_obj->getId(),$ops,
$target_id);
505 $ops = $rbacreview->getOperationsOfRole($role_obj->getId(),
"rolf",$rolf_obj->getRefId());
506 $rbacadmin->grantPermission($role_obj->getId(),$ops,$rolf_obj->getRefId());
508 $new_roles[] = $role_obj->getId();
518 return $new_roles ? $new_roles : array();
525 return $this->
__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
529 include_once
'./include/inc.header.php';
530 global $rbacsystem,$rbacreview,$ilAccess;
535 return $this->
__raiseError(
'No valid ref id given. Please choose an existing reference id of an ILIAS object',
547 return $this->
__raiseError(
"Parent with ID $target_id has been deleted.",
'CLIENT_TARGET_DELETED');
553 if(!$ilAccess->checkAccessOfUser($tmp_user->getId(),
'visible',
'',$tmp_obj->getRefId()))
557 $op_data = $rbacreview->getOperation(2);
558 $ops_data[] = $op_data;
560 if(!$ilAccess->checkAccessOfUser($tmp_user->getId(),
'read',
'',$tmp_obj->getRefId()))
567 $ops = $rbacreview->getOperationsOnTypeString($tmp_obj->getType());
568 foreach($ops as $ops_id)
570 $op_data = $rbacreview->getOperation($ops_id);
572 if($rbacsystem->checkAccessOfUser($user_id,$op_data[
'operation'],$tmp_obj->getRefId()))
574 $ops_data[$ops_id] = $op_data;
579 foreach($ops_data as
$data)
583 return $ret_data ? $ret_data : array();
598 return $this->
__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
602 include_once
'./include/inc.header.php';
604 global $rbacsystem, $rbacreview, $ilUser, $ilDB;
606 if (strcasecmp($role_type,
"") != 0 &&
607 strcasecmp($role_type,
"local") != 0 &&
608 strcasecmp($role_type,
"global") != 0 &&
609 strcasecmp($role_type,
"user") != 0 &&
610 strcasecmp($role_type,
"user_login") != 0 &&
611 strcasecmp($role_type,
"template") != 0)
613 return $this->
__raiseError(
'Called service with wrong role_type parameter \''.$role_type.
'\'',
'Client');
619 if (strcasecmp($role_type,
"template") == 0)
622 $roles = $rbacreview->getRolesByFilter(6, $ilUser->getId());
623 } elseif (strcasecmp($role_type,
"user")==0 || strcasecmp($role_type,
"user_login")==0)
627 if ($user_id != $ilUser->getId())
631 $timelimitOwner = $tmpUser->getTimeLimitOwner();
632 if(!$rbacsystem->checkAccess(
'read',$timelimitOwner))
634 return $this->
__raiseError(
'Check access for time limit owner failed.',
'Server');
639 $query = sprintf(
"SELECT object_data.title, rbac_fa.* FROM object_data, rbac_ua, rbac_fa WHERE rbac_ua.rol_id IN ('%s') AND rbac_ua.rol_id = rbac_fa.rol_id AND object_data.obj_id = rbac_fa.rol_id AND rbac_ua.usr_id=".$user_id,
640 join (
"','", $rbacreview->assignedRoles($user_id))
643 $rbacresult = $ilDB->query($query);
646 if ($rbacrow[
"assign"] !=
"y")
651 if ($rbacrow[
"parent"] == ROLE_FOLDER_ID)
663 "obj_id" =>$rbacrow[
"rol_id"],
664 "title" => $tmp_obj->getTitle(),
665 "description" => $tmp_obj->getDescription(),
666 "role_type" => $type);
669 } elseif ($id ==
"-1")
672 if(!$rbacsystem->checkAccess(
'read',ROLE_FOLDER_ID))
674 return $this->
__raiseError(
'Check access failed.',
'Server');
677 $roles = $rbacreview->getAssignableRoles(
false,
true);
683 if(!$rbacsystem->checkAccess(
'edit_permission',$id))
685 return $this->
__raiseError(
'Check access for local roles failed.',
'Server');
688 if (!is_numeric($id)) {
689 return $this->
__raiseError(
'Id must be numeric to process roles of a repository object.',
'Client');
692 $role_type =
"local";
694 $role_folder = $rbacreview->getRoleFolderOfObject($id);
696 if(count($role_folder))
698 foreach($rbacreview->getRolesOfRoleFolder($role_folder[
'ref_id'],
false) as $role_id)
702 $roles[] = array (
"obj_id" => $role_id,
"title" => $tmp_obj->getTitle(),
"description" => $tmp_obj->getDescription(),
"role_type" => $role_type);
709 include_once
'./webservice/soap/classes/class.ilSoapRoleObjectXMLWriter.php';
712 $xml_writer->setObjects($roles);
713 $xml_writer->setType ($role_type);
714 if($xml_writer->start())
716 return $xml_writer->getXML();
734 return $this->
__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
738 include_once
'./include/inc.header.php';
740 global $rbacsystem, $rbacreview, $ilUser, $ilDB;
743 if (strcasecmp($role_type,
"") != 0 &&
744 strcasecmp($role_type,
"local") != 0 &&
745 strcasecmp($role_type,
"global") != 0 &&
746 strcasecmp($role_type,
"template") != 0)
748 return $this->
__raiseError(
'Called service with wrong role_type parameter \''.$role_type.
'\'',
'Client');
751 if($combination !=
'and' and $combination !=
'or')
753 return $this->
__raiseError(
'No valid combination given. Must be "and" or "or".',
757 include_once
'./Services/Search/classes/class.ilQueryParser.php';
760 $query_parser->setMinWordLength(3);
762 $query_parser->parse();
763 if(!$query_parser->validate())
765 return $this->
__raiseError($query_parser->getMessage(),
'Client');
768 include_once
'./Services/Search/classes/class.ilObjectSearchFactory.php';
771 $object_search->setFilter(array(
"role",
"rolt"));
773 $res = $object_search->performSearch();
774 $res->filter(ROOT_FOLDER_ID, $combination ==
'and' ?
true :
false);
777 foreach(
$res->getUniqueResults() as $entry)
779 $obj_ids [] = $entry[
'obj_id'];
783 if (count($obj_ids)> 0 )
786 $roles = $rbacreview->getRolesForIDs($obj_ids, $role_type ==
"template");
789 include_once
'./webservice/soap/classes/class.ilSoapRoleObjectXMLWriter.php';
791 $xml_writer->setObjects($roles);
792 $xml_writer->setType ($role_type);
793 if($xml_writer->start())
795 return $xml_writer->getXML();
803 if (strcasecmp($role_type,
"user")==0)
807 if (!is_numeric($user_id))
809 return $this->
__raiseError(
'ID must be either numeric or ILIAS conform id for type \'user\'',
'Client');
811 } elseif (strcasecmp($role_type,
"user_login") == 0)
818 return $this->
__raiseError(
'User with login \''.$id.
'\' does not exist!
','Client
');