33 include_once
'./webservice/soap/classes/class.ilSoapAdministration.php';
44 if(!$this->__checkSession($sid))
49 global $rbacreview, $rbacsystem,$ilAccess;
53 return $this->
__raiseError(
'No valid role id given. Please choose an existing id of an ILIAS role',
58 $obj_ref = $rbacreview->getObjectReferenceOfRole($role_id);
59 if(!$ilAccess->checkAccess(
'edit_permission',
'',$obj_ref))
61 return $this->
__raiseError(
'Check access failed. No permission to delete role',
'Server');
65 foreach($assigned_users = $rbacreview->assignedUsers($role_id) as $user_id)
67 if(count($rbacreview->assignedRoles($user_id)) == 1)
69 return $this->
__raiseError(
'Cannot deassign last role of users',
75 $rolf_id = end($rolf_ids = $rbacreview->getFoldersAssignedToRole($role_id,
true));
76 $tmp_role->setParent($rolf_id);
87 if(!$this->__checkSession($sid))
92 global $rbacadmin,$rbacreview,$ilAccess;
96 return $this->
__raiseError(
'No valid user id given. Please choose an existing id of an ILIAS user',
101 return $this->
__raiseError(
'No valid role id given. Please choose an existing id of an ILIAS role',
105 $obj_ref = $rbacreview->getObjectReferenceOfRole($role_id);
106 if(!$ilAccess->checkAccess(
'edit_permission',
'',$obj_ref))
108 return $this->
__raiseError(
'Check access failed. No permission to assign users',
'Server');
111 if(!$rbacadmin->assignUser($role_id,$user_id))
113 return $this->
__raiseError(
'Error rbacadmin->assignUser()',
123 if(!$this->__checkSession($sid))
128 global $rbacadmin,$ilAccess,$rbacreview;
132 return $this->
__raiseError(
'No valid user id given. Please choose an existing id of an ILIAS user',
137 return $this->
__raiseError(
'No valid role id given. Please choose an existing id of an ILIAS role',
141 $obj_ref = $rbacreview->getObjectReferenceOfRole($role_id);
142 if(!$ilAccess->checkAccess(
'edit_permission',
'',$obj_ref))
144 return $this->
__raiseError(
'Check access failed. No permission to deassign users',
'Server');
147 if(!$rbacadmin->deassignUser($role_id,$user_id))
149 return $this->
__raiseError(
'Error rbacadmin->deassignUser()',
160 if(!$this->__checkSession($sid))
167 if(is_array($ops = $rbacreview->getOperations()))
182 if(!$this->__checkSession($sid))
187 global $rbacadmin,$ilAccess;
191 return $this->
__raiseError(
'No valid ref id given. Please choose an existing reference id of an ILIAS object',
196 return $this->
__raiseError(
'No valid role id given. Please choose an existing id of an ILIAS role',
199 if ($role_id == SYSTEM_ROLE_ID)
201 return $this->
__raiseError(
'Cannot revoke permissions of system role',
205 if(!$ilAccess->checkAccess(
'edit_permission',
'',
$ref_id))
207 return $this->
__raiseError(
'Check access failed. No permission to revoke permissions',
'Server');
210 $rbacadmin->revokePermission(
$ref_id,$role_id);
219 if(!$this->__checkSession($sid))
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);
256 $rbacadmin->grantPermission($role_id,$permissions,
$ref_id);
266 if(!$this->__checkSession($sid))
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 foreach($rbacreview->getRolesOfRoleFolder(
$ref_id,
false) as $role_id)
294 include_once
'./webservice/soap/classes/class.ilObjectXMLWriter.php';
297 $xml_writer->setObjects($objs);
298 if($xml_writer->start())
300 return $xml_writer->getXML();
311 if(!$this->__checkSession($sid))
320 return $this->
__raiseError(
'No valid user id given. Please choose an existing id of an ILIAS user',
324 foreach($rbacreview->assignedRoles($user_id) as $role_id)
333 include_once
'./webservice/soap/classes/class.ilObjectXMLWriter.php';
336 $xml_writer->setObjects($objs);
337 if($xml_writer->start())
339 return $xml_writer->getXML();
350 if(!$this->__checkSession($sid))
355 global $rbacreview, $objDefinition, $rbacsystem,$ilAccess;
359 return $this->
__raiseError(
'No valid ref id given. Please choose an existing reference id of an ILIAS object',
365 return $this->
__raiseError(
"Parent with ID $target_id has been deleted.",
'CLIENT_TARGET_DELETED');
368 if(!$ilAccess->checkAccess(
'edit_permission',
'',
$target_id))
370 return $this->
__raiseError(
'Check access failed. No permission to create roles',
'Server');
373 include_once
'webservice/soap/classes/class.ilObjectXMLParser.php';
376 $xml_parser->startParsing();
378 foreach($xml_parser->getObjectData() as $object_data)
382 if(substr($object_data[
'title'],0,3) ==
"il_")
384 return $this->
__raiseError(
'Rolenames are not allowed to start with "il_" ',
388 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
390 $role->setTitle($object_data[
'title']);
391 $role->setDescription($object_data[
'description']);
392 $role->setImportId($object_data[
'import_id']);
396 $new_roles[] = $role->getId();
399 return $new_roles ? $new_roles :
array();
407 if(!$this->__checkSession($sid))
412 global $rbacreview, $objDefinition, $rbacsystem, $rbacadmin,$ilAccess;
416 return $this->
__raiseError(
'No valid ref id given. Please choose an existing reference id of an ILIAS object',
421 return $this->
__raiseError(
'No valid template id given. Please choose an existing object id of an ILIAS role template',
428 return $this->
__raiseError(
"Parent with ID $target_id has been deleted.",
'CLIENT_TARGET_DELETED');
431 if(!$ilAccess->checkAccess(
'edit_permission',
'',
$target_id))
433 return $this->
__raiseError(
'Check access failed. No permission to create roles',
'Server');
437 include_once
'webservice/soap/classes/class.ilObjectXMLParser.php';
440 $xml_parser->startParsing();
442 foreach($xml_parser->getObjectData() as $object_data)
446 if(substr($object_data[
'title'],0,3) ==
"il_")
448 return $this->
__raiseError(
'Rolenames are not allowed to start with "il_" ',
452 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
454 $role->setTitle($object_data[
'title']);
455 $role->setDescription($object_data[
'description']);
456 $role->setImportId($object_data[
'import_id']);
465 $ops = $rbacreview->getOperationsOfRole($role->getId(),$tmp_obj->getType(),
$target_id);
466 $rbacadmin->grantPermission($role->getId(),$ops,
$target_id);
467 $new_roles[] = $role->getId();
477 return $new_roles ? $new_roles :
array();
485 if(!$this->__checkSession($sid))
490 global $rbacsystem,$rbacreview,$ilAccess;
495 return $this->
__raiseError(
'No valid ref id given. Please choose an existing reference id of an ILIAS object',
507 return $this->
__raiseError(
"Parent with ID $target_id has been deleted.",
'CLIENT_TARGET_DELETED');
513 if(!$ilAccess->checkAccessOfUser($tmp_user->getId(),
'visible',
'',$tmp_obj->getRefId()))
517 $op_data = $rbacreview->getOperation(2);
518 $ops_data[] = $op_data;
520 if(!$ilAccess->checkAccessOfUser($tmp_user->getId(),
'read',
'',$tmp_obj->getRefId()))
527 $ops = $rbacreview->getOperationsOnTypeString($tmp_obj->getType());
528 foreach($ops as $ops_id)
530 $op_data = $rbacreview->getOperation($ops_id);
532 if($rbacsystem->checkAccessOfUser($user_id,$op_data[
'operation'],$tmp_obj->getRefId()))
534 $ops_data[$ops_id] = $op_data;
539 foreach($ops_data as
$data)
543 return $ret_data ? $ret_data :
array();
559 if(!$this->__checkSession($sid))
566 if (strcasecmp($role_type,
"") != 0 &&
567 strcasecmp($role_type,
"local") != 0 &&
568 strcasecmp($role_type,
"global") != 0 &&
569 strcasecmp($role_type,
"user") != 0 &&
570 strcasecmp($role_type,
"user_login") != 0 &&
571 strcasecmp($role_type,
"template") != 0)
573 return $this->
__raiseError(
'Called service with wrong role_type parameter \''.$role_type.
'\'',
'Client');
579 if (strcasecmp($role_type,
"template") == 0)
582 $roles = $rbacreview->getRolesByFilter(6, $ilUser->getId());
583 } elseif (strcasecmp($role_type,
"user")==0 || strcasecmp($role_type,
"user_login")==0)
587 if ($user_id != $ilUser->getId())
591 $timelimitOwner = $tmpUser->getTimeLimitOwner();
592 if(!$rbacsystem->checkAccess(
'read',$timelimitOwner))
594 return $this->
__raiseError(
'Check access for time limit owner failed.',
'Server');
599 $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,
600 join (
"','", $rbacreview->assignedRoles($user_id))
603 $rbacresult = $ilDB->query(
$query);
606 if ($rbacrow[
"assign"] !=
"y")
611 if ($rbacrow[
"parent"] == ROLE_FOLDER_ID)
623 "obj_id" =>$rbacrow[
"rol_id"],
624 "title" => $tmp_obj->getTitle(),
625 "description" => $tmp_obj->getDescription(),
626 "role_type" => $type);
629 } elseif ($id ==
"-1")
632 if(!$rbacsystem->checkAccess(
'read',ROLE_FOLDER_ID))
634 return $this->
__raiseError(
'Check access failed.',
'Server');
637 $roles = $rbacreview->getAssignableRoles(
false,
true);
643 if(!$rbacsystem->checkAccess(
'edit_permission',$id))
645 return $this->
__raiseError(
'Check access for local roles failed.',
'Server');
648 if (!is_numeric($id)) {
649 return $this->
__raiseError(
'Id must be numeric to process roles of a repository object.',
'Client');
652 $role_type =
"local";
654 foreach($rbacreview->getRolesOfRoleFolder($id,
false) as $role_id)
658 $roles[] =
array (
"obj_id" => $role_id,
"title" => $tmp_obj->getTitle(),
"description" => $tmp_obj->getDescription(),
"role_type" => $role_type);
664 include_once
'./webservice/soap/classes/class.ilSoapRoleObjectXMLWriter.php';
667 $xml_writer->setObjects($roles);
668 $xml_writer->setType ($role_type);
669 if($xml_writer->start())
671 return $xml_writer->getXML();
690 if(!$this->__checkSession($sid))
698 if (strcasecmp($role_type,
"") != 0 &&
699 strcasecmp($role_type,
"local") != 0 &&
700 strcasecmp($role_type,
"global") != 0 &&
701 strcasecmp($role_type,
"template") != 0)
703 return $this->
__raiseError(
'Called service with wrong role_type parameter \''.$role_type.
'\'',
'Client');
706 if($combination !=
'and' and $combination !=
'or')
708 return $this->
__raiseError(
'No valid combination given. Must be "and" or "or".',
712 include_once
'./Services/Search/classes/class.ilQueryParser.php';
715 $query_parser->setMinWordLength(3);
717 $query_parser->parse();
718 if(!$query_parser->validate())
720 return $this->
__raiseError($query_parser->getMessage(),
'Client');
723 include_once
'./Services/Search/classes/class.ilObjectSearchFactory.php';
726 $object_search->setFilter(
array(
"role",
"rolt"));
728 $res = $object_search->performSearch();
729 $res->filter(ROOT_FOLDER_ID, $combination ==
'and' ?
true :
false);
732 foreach(
$res->getUniqueResults() as $entry)
734 $obj_ids [] = $entry[
'obj_id'];
738 if (count($obj_ids)> 0 )
741 $roles = $rbacreview->getRolesForIDs($obj_ids, $role_type ==
"template");
744 include_once
'./webservice/soap/classes/class.ilSoapRoleObjectXMLWriter.php';
746 $xml_writer->setObjects($roles);
747 $xml_writer->setType ($role_type);
748 if($xml_writer->start())
750 return $xml_writer->getXML();
758 if (strcasecmp($role_type,
"user")==0)
762 if (!is_numeric($user_id))
764 return $this->
__raiseError(
'ID must be either numeric or ILIAS conform id for type \'user\'',
'Client');
766 } elseif (strcasecmp($role_type,
"user_login") == 0)
773 return $this->
__raiseError(
'User with login \''.$id.
'\' does not exist!
','Client
');
parseUserID($id, $role_type)
grantPermissions($sid, $ref_id, $role_id, $permissions)
addUserRoleEntry($sid, $user_id, $role_id)
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
static _isInTrash($a_ref_id)
checks wether object is in trash
static _lookupId($a_user_str)
Lookup id by login.
getUserRoles($sid, $user_id)
searchRoles($sid, $key, $combination, $role_type)
search for roles.
addRole($sid, $target_id, $role_xml)
getRoles($sid, $role_type, $id)
get roles for a specific type and id
revokePermissions($sid, $ref_id, $role_id)
__raiseError($a_message, $a_code)
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
getLocalRoles($sid, $ref_id)
addRoleFromTemplate($sid, $target_id, $role_xml, $template_id)
deleteRole($sid, $role_id)
static _getObjectSearchInstance($query_parser)
get reference of ilFulltext/LikeObjectSearch.
initAuth($sid)
Init authentication.
deleteUserRoleEntry($sid, $user_id, $role_id)
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
getObjectTreeOperations($sid, $ref_id, $user_id)
static __extractId($ilias_id, $inst_id)
extract ref id from role title, e.g.