33 include_once
'./webservice/soap/classes/class.ilSoapAdministration.php';
42 if (!$this->__checkSession($sid)) {
46 global $rbacreview, $rbacsystem,$ilAccess;
50 'No valid role id given. Please choose an existing id of an ILIAS role',
56 $obj_ref = $rbacreview->getObjectReferenceOfRole($role_id);
57 if (!$ilAccess->checkAccess(
'edit_permission',
'', $obj_ref)) {
58 return $this->
__raiseError(
'Check access failed. No permission to delete role',
'Server');
62 foreach ($assigned_users = $rbacreview->assignedUsers($role_id) as $user_id) {
63 if (count($rbacreview->assignedRoles($user_id)) == 1) {
65 'Cannot deassign last role of users',
72 $rolf_id = end($rolf_ids = $rbacreview->getFoldersAssignedToRole($role_id,
true));
73 $tmp_role->setParent($rolf_id);
84 if (!$this->__checkSession($sid)) {
88 global $rbacadmin,$rbacreview,$ilAccess;
92 'No valid user id given. Please choose an existing id of an ILIAS user',
98 'No valid role id given. Please choose an existing id of an ILIAS role',
103 $obj_ref = $rbacreview->getObjectReferenceOfRole($role_id);
104 if (!$ilAccess->checkAccess(
'edit_permission',
'', $obj_ref)) {
105 return $this->
__raiseError(
'Check access failed. No permission to assign users',
'Server');
108 if (!$rbacadmin->assignUser($role_id, $user_id)) {
110 'Error rbacadmin->assignUser()',
121 if (!$this->__checkSession($sid)) {
125 global $rbacadmin,$ilAccess,$rbacreview;
129 'No valid user id given. Please choose an existing id of an ILIAS user',
135 'No valid role id given. Please choose an existing id of an ILIAS role',
140 $obj_ref = $rbacreview->getObjectReferenceOfRole($role_id);
141 if (!$ilAccess->checkAccess(
'edit_permission',
'', $obj_ref)) {
142 return $this->
__raiseError(
'Check access failed. No permission to deassign users',
'Server');
145 if (!$rbacadmin->deassignUser($role_id, $user_id)) {
147 'Error rbacadmin->deassignUser()',
159 if (!$this->__checkSession($sid)) {
165 if (is_array($ops = $rbacreview->getOperations())) {
177 if (!$this->__checkSession($sid)) {
181 global $rbacadmin,$ilAccess;
185 'No valid ref id given. Please choose an existing reference id of an ILIAS object',
191 'No valid role id given. Please choose an existing id of an ILIAS role',
195 if ($role_id == SYSTEM_ROLE_ID) {
197 'Cannot revoke permissions of system role',
202 if (!$ilAccess->checkAccess(
'edit_permission',
'', $ref_id)) {
203 return $this->
__raiseError(
'Check access failed. No permission to revoke permissions',
'Server');
206 $rbacadmin->revokePermission($ref_id, $role_id);
215 if (!$this->__checkSession($sid)) {
219 global $rbacadmin,$ilAccess;
223 'No valid ref id given. Please choose an existing reference id of an ILIAS object',
229 'No valid role id given. Please choose an existing id of an ILIAS role',
234 if (!$ilAccess->checkAccess(
'edit_permission',
'', $ref_id)) {
235 return $this->
__raiseError(
'Check access failed. No permission to grant permissions',
'Server');
240 if (isset($permissions[
'item'])) {
241 $permissions = $permissions[
'item'];
244 if (!is_array($permissions)) {
246 'No valid permissions given.' . print_r($permissions),
251 $rbacadmin->revokePermission($ref_id, $role_id);
252 $rbacadmin->grantPermission($role_id, $permissions, $ref_id);
262 if (!$this->__checkSession($sid)) {
266 global $rbacreview,$ilAccess;
270 'No valid ref id given. Please choose an existing reference id of an ILIAS object',
275 if (!$ilAccess->checkAccess(
'edit_permission',
'', $ref_id)) {
276 return $this->
__raiseError(
'Check access failed. No permission to access role information',
'Server');
280 foreach ($rbacreview->getRolesOfRoleFolder($ref_id,
false) as $role_id) {
286 include_once
'./webservice/soap/classes/class.ilObjectXMLWriter.php';
289 $xml_writer->setObjects($objs);
290 if ($xml_writer->start()) {
291 return $xml_writer->getXML();
302 if (!$this->__checkSession($sid)) {
310 'No valid user id given. Please choose an existing id of an ILIAS user',
315 foreach ($rbacreview->assignedRoles($user_id) as $role_id) {
321 include_once
'./webservice/soap/classes/class.ilObjectXMLWriter.php';
324 $xml_writer->setObjects($objs);
325 if ($xml_writer->start()) {
326 return $xml_writer->getXML();
337 if (!$this->__checkSession($sid)) {
341 global $rbacreview, $objDefinition, $rbacsystem,$ilAccess;
345 'No valid ref id given. Please choose an existing reference id of an ILIAS object',
351 return $this->
__raiseError(
"Parent with ID $target_id has been deleted.",
'CLIENT_TARGET_DELETED');
354 if (!$ilAccess->checkAccess(
'edit_permission',
'',
$target_id)) {
355 return $this->
__raiseError(
'Check access failed. No permission to create roles',
'Server');
358 include_once
'webservice/soap/classes/class.ilObjectXMLParser.php';
361 $xml_parser->startParsing();
363 foreach ($xml_parser->getObjectData() as $object_data) {
366 if (substr($object_data[
'title'], 0, 3) ==
"il_") {
368 'Rolenames are not allowed to start with "il_" ',
373 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
375 $role->setTitle($object_data[
'title']);
376 $role->setDescription($object_data[
'description']);
377 $role->setImportId($object_data[
'import_id']);
381 $new_roles[] = $role->getId();
384 return $new_roles ? $new_roles :
array();
392 if (!$this->__checkSession($sid)) {
396 global $rbacreview, $objDefinition, $rbacsystem, $rbacadmin,$ilAccess;
400 'No valid ref id given. Please choose an existing reference id of an ILIAS object',
406 'No valid template id given. Please choose an existing object id of an ILIAS role template',
413 return $this->
__raiseError(
"Parent with ID $target_id has been deleted.",
'CLIENT_TARGET_DELETED');
416 if (!$ilAccess->checkAccess(
'edit_permission',
'',
$target_id)) {
417 return $this->
__raiseError(
'Check access failed. No permission to create roles',
'Server');
421 include_once
'webservice/soap/classes/class.ilObjectXMLParser.php';
424 $xml_parser->startParsing();
426 foreach ($xml_parser->getObjectData() as $object_data) {
429 if (substr($object_data[
'title'], 0, 3) ==
"il_") {
431 'Rolenames are not allowed to start with "il_" ',
436 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
438 $role->setTitle($object_data[
'title']);
439 $role->setDescription($object_data[
'description']);
440 $role->setImportId($object_data[
'import_id']);
449 $ops = $rbacreview->getOperationsOfRole($role->getId(), $tmp_obj->getType(),
$target_id);
450 $rbacadmin->grantPermission($role->getId(), $ops,
$target_id);
451 $new_roles[] = $role->getId();
461 return $new_roles ? $new_roles :
array();
469 if (!$this->__checkSession($sid)) {
473 global $rbacsystem,$rbacreview,$ilAccess;
478 'No valid ref id given. Please choose an existing reference id of an ILIAS object',
485 'No valid user id given.',
491 return $this->
__raiseError(
"Parent with ID $target_id has been deleted.",
'CLIENT_TARGET_DELETED');
497 if (!$ilAccess->checkAccessOfUser($tmp_user->getId(),
'visible',
'', $tmp_obj->getRefId())) {
500 $op_data = $rbacreview->getOperation(2);
501 $ops_data[] = $op_data;
503 if (!$ilAccess->checkAccessOfUser($tmp_user->getId(),
'read',
'', $tmp_obj->getRefId())) {
509 $ops = $rbacreview->getOperationsOnTypeString($tmp_obj->getType());
510 foreach ($ops as $ops_id) {
511 $op_data = $rbacreview->getOperation($ops_id);
513 if ($rbacsystem->checkAccessOfUser($user_id, $op_data[
'operation'], $tmp_obj->getRefId())) {
514 $ops_data[$ops_id] = $op_data;
518 foreach ($ops_data as
$data) {
521 return $ret_data ? $ret_data :
array();
537 if (!$this->__checkSession($sid)) {
543 if (strcasecmp($role_type,
"") != 0 &&
544 strcasecmp($role_type,
"local") != 0 &&
545 strcasecmp($role_type,
"global") != 0 &&
546 strcasecmp($role_type,
"user") != 0 &&
547 strcasecmp($role_type,
"user_login") != 0 &&
548 strcasecmp($role_type,
"template") != 0) {
549 return $this->
__raiseError(
'Called service with wrong role_type parameter \'' . $role_type .
'\'',
'Client');
555 if (strcasecmp($role_type,
"template") == 0) {
557 $roles = $rbacreview->getRolesByFilter(6, $ilUser->getId());
558 } elseif (strcasecmp($role_type,
"user")==0 || strcasecmp($role_type,
"user_login")==0) {
561 if ($user_id != $ilUser->getId()) {
564 $timelimitOwner = $tmpUser->getTimeLimitOwner();
565 if (!$rbacsystem->checkAccess(
'read', $timelimitOwner)) {
566 return $this->
__raiseError(
'Check access for time limit owner failed.',
'Server');
572 "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,
573 join(
"','", $rbacreview->assignedRoles($user_id))
576 $rbacresult = $ilDB->query(
$query);
578 if ($rbacrow[
"assign"] !=
"y") {
584 if ($rbacrow[
"parent"] == ROLE_FOLDER_ID) {
592 "obj_id" =>$rbacrow[
"rol_id"],
593 "title" => $tmp_obj->getTitle(),
594 "description" => $tmp_obj->getDescription(),
595 "role_type" =>
$type);
598 } elseif (
$id ==
"-1") {
600 if (!$rbacsystem->checkAccess(
'read', ROLE_FOLDER_ID)) {
601 return $this->
__raiseError(
'Check access failed.',
'Server');
604 $roles = $rbacreview->getAssignableRoles(
false,
true);
608 if (!$rbacsystem->checkAccess(
'edit_permission',
$id)) {
609 return $this->
__raiseError(
'Check access for local roles failed.',
'Server');
612 if (!is_numeric(
$id)) {
613 return $this->
__raiseError(
'Id must be numeric to process roles of a repository object.',
'Client');
616 $role_type =
"local";
618 foreach ($rbacreview->getRolesOfRoleFolder(
$id,
false) as $role_id) {
620 $roles[] =
array(
"obj_id" => $role_id,
"title" => $tmp_obj->getTitle(),
"description" => $tmp_obj->getDescription(),
"role_type" => $role_type);
626 include_once
'./webservice/soap/classes/class.ilSoapRoleObjectXMLWriter.php';
629 $xml_writer->setObjects($roles);
630 $xml_writer->setType($role_type);
631 if ($xml_writer->start()) {
632 return $xml_writer->getXML();
651 if (!$this->__checkSession($sid)) {
658 if (strcasecmp($role_type,
"") != 0 &&
659 strcasecmp($role_type,
"local") != 0 &&
660 strcasecmp($role_type,
"global") != 0 &&
661 strcasecmp($role_type,
"template") != 0) {
662 return $this->
__raiseError(
'Called service with wrong role_type parameter \'' . $role_type .
'\'',
'Client');
665 if ($combination !=
'and' and $combination !=
'or') {
667 'No valid combination given. Must be "and" or "or".',
672 include_once
'./Services/Search/classes/class.ilQueryParser.php';
675 $query_parser->setMinWordLength(3);
677 $query_parser->parse();
678 if (!$query_parser->validate()) {
679 return $this->
__raiseError($query_parser->getMessage(),
'Client');
682 include_once
'./Services/Search/classes/class.ilObjectSearchFactory.php';
685 $object_search->setFilter(
array(
"role",
"rolt"));
687 $res = $object_search->performSearch();
688 $res->filter(ROOT_FOLDER_ID, $combination ==
'and' ?
true :
false);
691 foreach (
$res->getUniqueResults() as $entry) {
692 $obj_ids [] = $entry[
'obj_id'];
696 if (count($obj_ids)> 0) {
698 $roles = $rbacreview->getRolesForIDs($obj_ids, $role_type ==
"template");
701 include_once
'./webservice/soap/classes/class.ilSoapRoleObjectXMLWriter.php';
703 $xml_writer->setObjects($roles);
704 $xml_writer->setType($role_type);
705 if ($xml_writer->start()) {
706 return $xml_writer->getXML();
713 if (strcasecmp($role_type,
"user")==0) {
716 if (!is_numeric($user_id)) {
717 return $this->
__raiseError(
'ID must be either numeric or ILIAS conform id for type \'user\'',
'Client');
719 } elseif (strcasecmp($role_type,
"user_login") == 0) {
724 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.
if(!array_key_exists('StateId', $_REQUEST)) $id
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)
foreach($_POST as $key=> $value) $res
__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.