33 include_once
'./webservice/soap/classes/class.ilSoapAdministration.php';
48 if(!$this->__checkSession($sid))
53 global $rbacreview, $rbacsystem,$ilAccess;
57 return $this->
__raiseError(
'No valid role id given. Please choose an existing id of an ILIAS role',
62 $obj_ref = $rbacreview->getObjectReferenceOfRole($role_id);
63 if(!$ilAccess->checkAccess(
'edit_permission',
'',$obj_ref))
65 return $this->
__raiseError(
'Check access failed. No permission to delete role',
'Server');
69 foreach($assigned_users = $rbacreview->assignedUsers($role_id) as $user_id)
71 if(count($rbacreview->assignedRoles($user_id)) == 1)
73 return $this->
__raiseError(
'Cannot deassign last role of users',
79 $rolf_id = end($rolf_ids = $rbacreview->getFoldersAssignedToRole($role_id,
true));
80 $tmp_role->setParent($rolf_id);
91 if(!$this->__checkSession($sid))
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->getObjectReferenceOfRole($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()',
127 if(!$this->__checkSession($sid))
132 global $rbacadmin,$ilAccess,$rbacreview;
136 return $this->
__raiseError(
'No valid user id given. Please choose an existing id of an ILIAS user',
141 return $this->
__raiseError(
'No valid role id given. Please choose an existing id of an ILIAS role',
145 $obj_ref = $rbacreview->getObjectReferenceOfRole($role_id);
146 if(!$ilAccess->checkAccess(
'edit_permission',
'',$obj_ref))
148 return $this->
__raiseError(
'Check access failed. No permission to deassign users',
'Server');
151 if(!$rbacadmin->deassignUser($role_id,$user_id))
153 return $this->
__raiseError(
'Error rbacadmin->deassignUser()',
164 if(!$this->__checkSession($sid))
171 if(is_array($ops = $rbacreview->getOperations()))
186 if(!$this->__checkSession($sid))
191 global $rbacadmin,$ilAccess;
195 return $this->
__raiseError(
'No valid ref id given. Please choose an existing reference id of an ILIAS object',
200 return $this->
__raiseError(
'No valid role id given. Please choose an existing id of an ILIAS role',
203 if ($role_id == SYSTEM_ROLE_ID)
205 return $this->
__raiseError(
'Cannot revoke permissions of system role',
209 if(!$ilAccess->checkAccess(
'edit_permission',
'',
$ref_id))
211 return $this->
__raiseError(
'Check access failed. No permission to revoke permissions',
'Server');
214 $rbacadmin->revokePermission(
$ref_id,$role_id);
223 if(!$this->__checkSession($sid))
228 global $rbacadmin,$ilAccess;
232 return $this->
__raiseError(
'No valid ref id given. Please choose an existing reference id of an ILIAS object',
237 return $this->
__raiseError(
'No valid role id given. Please choose an existing id of an ILIAS role',
241 if(!$ilAccess->checkAccess(
'edit_permission',
'',
$ref_id))
243 return $this->
__raiseError(
'Check access failed. No permission to grant permissions',
'Server');
248 if(isset($permissions[
'item']))
250 $permissions = $permissions[
'item'];
253 if(!is_array($permissions))
255 return $this->
__raiseError(
'No valid permissions given.'.print_r($permissions),
259 $rbacadmin->revokePermission(
$ref_id,$role_id);
260 $rbacadmin->grantPermission($role_id,$permissions,
$ref_id);
270 if(!$this->__checkSession($sid))
275 global $rbacreview,$ilAccess;
279 return $this->
__raiseError(
'No valid ref id given. Please choose an existing reference id of an ILIAS object',
283 if(!$ilAccess->checkAccess(
'edit_permission',
'',
$ref_id))
285 return $this->
__raiseError(
'Check access failed. No permission to access role information',
'Server');
289 foreach($rbacreview->getRolesOfRoleFolder(
$ref_id,
false) as $role_id)
298 include_once
'./webservice/soap/classes/class.ilObjectXMLWriter.php';
301 $xml_writer->setObjects($objs);
302 if($xml_writer->start())
304 return $xml_writer->getXML();
315 if(!$this->__checkSession($sid))
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();
354 if(!$this->__checkSession($sid))
359 global $rbacreview, $objDefinition, $rbacsystem,$ilAccess;
363 return $this->
__raiseError(
'No valid ref id given. Please choose an existing reference id of an ILIAS object',
369 return $this->
__raiseError(
"Parent with ID $target_id has been deleted.",
'CLIENT_TARGET_DELETED');
372 if(!$ilAccess->checkAccess(
'edit_permission',
'',
$target_id))
374 return $this->
__raiseError(
'Check access failed. No permission to create roles',
'Server');
377 include_once
'webservice/soap/classes/class.ilObjectXMLParser.php';
380 $xml_parser->startParsing();
382 foreach($xml_parser->getObjectData() as $object_data)
386 if(substr($object_data[
'title'],0,3) ==
"il_")
388 return $this->
__raiseError(
'Rolenames are not allowed to start with "il_" ',
392 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
394 $role->setTitle($object_data[
'title']);
395 $role->setDescription($object_data[
'description']);
396 $role->setImportId($object_data[
'import_id']);
400 $new_roles[] = $role->getId();
403 return $new_roles ? $new_roles : array();
411 if(!$this->__checkSession($sid))
416 global $rbacreview, $objDefinition, $rbacsystem, $rbacadmin,$ilAccess;
420 return $this->
__raiseError(
'No valid ref id given. Please choose an existing reference id of an ILIAS object',
425 return $this->
__raiseError(
'No valid template id given. Please choose an existing object id of an ILIAS role template',
432 return $this->
__raiseError(
"Parent with ID $target_id has been deleted.",
'CLIENT_TARGET_DELETED');
435 if(!$ilAccess->checkAccess(
'edit_permission',
'',
$target_id))
437 return $this->
__raiseError(
'Check access failed. No permission to create roles',
'Server');
441 include_once
'webservice/soap/classes/class.ilObjectXMLParser.php';
444 $xml_parser->startParsing();
446 foreach($xml_parser->getObjectData() as $object_data)
450 if(substr($object_data[
'title'],0,3) ==
"il_")
452 return $this->
__raiseError(
'Rolenames are not allowed to start with "il_" ',
456 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
458 $role->setTitle($object_data[
'title']);
459 $role->setDescription($object_data[
'description']);
460 $role->setImportId($object_data[
'import_id']);
466 $rbacadmin->copyRoleTemplatePermissions($template_id,ROLE_FOLDER_ID,
$target_id,$role->getId());
469 $ops = $rbacreview->getOperationsOfRole($role->getId(),$tmp_obj->getType(),
$target_id);
470 $rbacadmin->grantPermission($role->getId(),$ops,
$target_id);
471 $new_roles[] = $role->getId();
481 return $new_roles ? $new_roles : array();
489 if(!$this->__checkSession($sid))
494 global $rbacsystem,$rbacreview,$ilAccess;
499 return $this->
__raiseError(
'No valid ref id given. Please choose an existing reference id of an ILIAS object',
511 return $this->
__raiseError(
"Parent with ID $target_id has been deleted.",
'CLIENT_TARGET_DELETED');
517 if(!$ilAccess->checkAccessOfUser($tmp_user->getId(),
'visible',
'',$tmp_obj->getRefId()))
521 $op_data = $rbacreview->getOperation(2);
522 $ops_data[] = $op_data;
524 if(!$ilAccess->checkAccessOfUser($tmp_user->getId(),
'read',
'',$tmp_obj->getRefId()))
531 $ops = $rbacreview->getOperationsOnTypeString($tmp_obj->getType());
532 foreach($ops as $ops_id)
534 $op_data = $rbacreview->getOperation($ops_id);
536 if($rbacsystem->checkAccessOfUser($user_id,$op_data[
'operation'],$tmp_obj->getRefId()))
538 $ops_data[$ops_id] = $op_data;
543 foreach($ops_data as $data)
547 return $ret_data ? $ret_data : array();
563 if(!$this->__checkSession($sid))
570 if (strcasecmp($role_type,
"") != 0 &&
571 strcasecmp($role_type,
"local") != 0 &&
572 strcasecmp($role_type,
"global") != 0 &&
573 strcasecmp($role_type,
"user") != 0 &&
574 strcasecmp($role_type,
"user_login") != 0 &&
575 strcasecmp($role_type,
"template") != 0)
577 return $this->
__raiseError(
'Called service with wrong role_type parameter \''.$role_type.
'\'',
'Client');
583 if (strcasecmp($role_type,
"template") == 0)
586 $roles = $rbacreview->getRolesByFilter(6, $ilUser->getId());
587 } elseif (strcasecmp($role_type,
"user")==0 || strcasecmp($role_type,
"user_login")==0)
591 if ($user_id != $ilUser->getId())
595 $timelimitOwner = $tmpUser->getTimeLimitOwner();
596 if(!$rbacsystem->checkAccess(
'read',$timelimitOwner))
598 return $this->
__raiseError(
'Check access for time limit owner failed.',
'Server');
603 $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,
604 join (
"','", $rbacreview->assignedRoles($user_id))
607 $rbacresult = $ilDB->query(
$query);
610 if ($rbacrow[
"assign"] !=
"y")
615 if ($rbacrow[
"parent"] == ROLE_FOLDER_ID)
627 "obj_id" =>$rbacrow[
"rol_id"],
628 "title" => $tmp_obj->getTitle(),
629 "description" => $tmp_obj->getDescription(),
630 "role_type" => $type);
633 } elseif ($id ==
"-1")
636 if(!$rbacsystem->checkAccess(
'read',ROLE_FOLDER_ID))
638 return $this->
__raiseError(
'Check access failed.',
'Server');
641 $roles = $rbacreview->getAssignableRoles(
false,
true);
647 if(!$rbacsystem->checkAccess(
'edit_permission',$id))
649 return $this->
__raiseError(
'Check access for local roles failed.',
'Server');
652 if (!is_numeric($id)) {
653 return $this->
__raiseError(
'Id must be numeric to process roles of a repository object.',
'Client');
656 $role_type =
"local";
658 foreach($rbacreview->getRolesOfRoleFolder($id,
false) as $role_id)
662 $roles[] = array (
"obj_id" => $role_id,
"title" => $tmp_obj->getTitle(),
"description" => $tmp_obj->getDescription(),
"role_type" => $role_type);
668 include_once
'./webservice/soap/classes/class.ilSoapRoleObjectXMLWriter.php';
671 $xml_writer->setObjects($roles);
672 $xml_writer->setType ($role_type);
673 if($xml_writer->start())
675 return $xml_writer->getXML();
694 if(!$this->__checkSession($sid))
702 if (strcasecmp($role_type,
"") != 0 &&
703 strcasecmp($role_type,
"local") != 0 &&
704 strcasecmp($role_type,
"global") != 0 &&
705 strcasecmp($role_type,
"template") != 0)
707 return $this->
__raiseError(
'Called service with wrong role_type parameter \''.$role_type.
'\'',
'Client');
710 if($combination !=
'and' and $combination !=
'or')
712 return $this->
__raiseError(
'No valid combination given. Must be "and" or "or".',
716 include_once
'./Services/Search/classes/class.ilQueryParser.php';
719 $query_parser->setMinWordLength(3);
721 $query_parser->parse();
722 if(!$query_parser->validate())
724 return $this->
__raiseError($query_parser->getMessage(),
'Client');
727 include_once
'./Services/Search/classes/class.ilObjectSearchFactory.php';
730 $object_search->setFilter(array(
"role",
"rolt"));
732 $res = $object_search->performSearch();
733 $res->filter(ROOT_FOLDER_ID, $combination ==
'and' ?
true :
false);
736 foreach(
$res->getUniqueResults() as $entry)
738 $obj_ids [] = $entry[
'obj_id'];
742 if (count($obj_ids)> 0 )
745 $roles = $rbacreview->getRolesForIDs($obj_ids, $role_type ==
"template");
748 include_once
'./webservice/soap/classes/class.ilSoapRoleObjectXMLWriter.php';
750 $xml_writer->setObjects($roles);
751 $xml_writer->setType ($role_type);
752 if($xml_writer->start())
754 return $xml_writer->getXML();
762 if (strcasecmp($role_type,
"user")==0)
766 if (!is_numeric($user_id))
768 return $this->
__raiseError(
'ID must be either numeric or ILIAS conform id for type \'user\'',
'Client');
770 } elseif (strcasecmp($role_type,
"user_login") == 0)
777 return $this->
__raiseError(
'User with login \''.$id.
'\' does not exist!
','Client
');