24 require_once
"./classes/class.ilObjectGUI.php";
61 function ilObjRoleGUI($a_data,$a_id,$a_call_by_reference =
false,$a_prepare_output =
true)
65 $lng->loadLanguageModule(
'rbac');
68 define(
"USER_FOLDER_ID",7);
71 if (
$_GET[
'rolf_ref_id'] !=
"")
73 $this->rolf_ref_id =
$_GET[
'rolf_ref_id'];
77 $this->rolf_ref_id =
$_GET[
'ref_id'];
81 $this->obj_ref_id = $tree->getParentId($this->rolf_ref_id);
84 $this->
ilObjectGUI($a_data,$a_id,$a_call_by_reference,
false);
85 $this->ctrl->saveParameter($this, array(
"obj_id",
"rolf_ref_id"));
102 if($this->ctrl->getTargetScript() ==
'repository.php' ||
103 $this->ctrl->getTargetScript() ==
'role.php' ||
104 $this->ctrl->getTargetScript() ==
'fblm_edit.php' ||
105 strtolower(
$_GET[
"baseClass"]) ==
'ilchathandlergui' ||
106 strtolower(
$_GET[
"baseClass"]) ==
'ilchatpresentationgui' ||
107 strtolower(
$_GET[
"baseClass"]) ==
'illmeditorgui' ||
108 strtolower(
$_GET[
"baseClass"]) ==
'ilexercisehandlergui' ||
109 strtolower(
$_GET[
"baseClass"]) ==
'illinkresourcehandlergui' ||
110 strtolower(
$_GET[
"baseClass"]) ==
'ilsahseditgui' ||
111 strtolower(
$_GET[
"baseClass"]) ==
'ilobjsurveygui' ||
112 strtolower(
$_GET[
"baseClass"]) ==
'ilwikihandlergui' ||
113 strtolower(
$_GET[
"baseClass"]) ==
'ilmediapoolpresentation' ||
114 strtolower(
$_GET[
"baseClass"]) ==
'ilobjsurveyquestionpoolgui' ||
115 strtolower(
$_GET[
"baseClass"]) ==
'ilobjtestgui' ||
116 strtolower(
$_GET[
"baseClass"]) ==
'ilobjquestionpoolgui' ||
117 strtolower(
$_GET[
"baseClass"]) ==
'ilglossaryeditorgui' ||
118 $_GET[
"admin_mode"] ==
"repository")
124 if (
$_GET[
"ref_id"] != SYSTEM_FOLDER_ID)
136 $next_class = $this->ctrl->getNextClass($this);
137 $cmd = $this->ctrl->getCmd();
160 $this->back_target = array(
"text" => $a_text,
175 global $rbacsystem,$rbacreview,
$tree;
177 #if(!$rbacsystem->checkAccess('edit_permission', $this->rolf_ref_id))
180 $this->ilias->raiseError($this->lng->txt(
"permission_denied"),$this->ilias->error_obj->MESSAGE);
184 $this->rolf_ref_id != ROLE_FOLDER_ID)
191 include_once
'./classes/class.ilRoleDesktopItem.php';
196 $this->
__showButton(
'selectDesktopItem',$this->lng->txt(
'role_desk_add'));
198 if(!count($items = $role_desk_item_obj->getAll()))
203 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.role_desktop_item_list.html");
204 $this->tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
206 $this->tpl->setVariable(
"TBL_TITLE_IMG_ALT",$this->lng->txt(
'obj_role'));
207 $this->tpl->setVariable(
"TBL_TITLE",$this->lng->txt(
'role_assigned_desk_items').
' ('.$this->
object->getTitle().
')');
208 $this->tpl->setVariable(
"HEADER_DESC",$this->lng->txt(
'description'));
209 $this->tpl->setVariable(
"BTN_DELETE",$this->lng->txt(
'delete'));
214 foreach($items as $role_item_id => $item)
218 if(strlen($desc = $tmp_obj->getDescription()))
220 $this->tpl->setCurrentBlock(
"description");
221 $this->tpl->setVariable(
"DESCRIPTION_DESK",$desc);
222 $this->tpl->parseCurrentBlock();
224 $this->tpl->setCurrentBlock(
"desk_row");
225 $this->tpl->setVariable(
"DESK_TITLE",$tmp_obj->getTitle());
227 $this->tpl->setVariable(
"CHECK_DESK",ilUtil::formCheckBox(0,
'del_desk_item[]',$role_item_id));
228 $this->tpl->setVariable(
"TXT_PATH",$this->lng->txt(
'path').
':');
229 $this->tpl->setVariable(
"PATH",$this->
__formatPath($tree->getPathFull($item[
'item_id'])));
230 $this->tpl->parseCurrentBlock();
241 #if(!$rbacsystem->checkAccess('edit_permission', $this->rolf_ref_id))
244 $this->ilias->raiseError($this->lng->txt(
"permission_denied"),$this->ilias->error_obj->MESSAGE);
246 if(!$rbacsystem->checkAccess(
'push_desktop_items',
USER_FOLDER_ID))
248 $this->ilias->raiseError($this->lng->txt(
"permission_denied"),$this->ilias->error_obj->MESSAGE);
250 if(!count($_POST[
'del_desk_item']))
260 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.role_ask_delete_desktop_item.html");
261 $this->tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
263 $this->tpl->setVariable(
"TBL_TITLE_IMG_ALT",$this->lng->txt(
'obj_role'));
264 $this->tpl->setVariable(
"TBL_TITLE",$this->lng->txt(
'role_assigned_desk_items').
' ('.$this->
object->getTitle().
')');
265 $this->tpl->setVariable(
"HEADER_DESC",$this->lng->txt(
'description'));
266 $this->tpl->setVariable(
"BTN_DELETE",$this->lng->txt(
'delete'));
267 $this->tpl->setVariable(
"BTN_CANCEL",$this->lng->txt(
'cancel'));
269 include_once
'./classes/class.ilRoleDesktopItem.php';
275 foreach($_POST[
'del_desk_item'] as $role_item_id)
277 $item_data = $role_desk_item_obj->
getItem($role_item_id);
280 if(strlen($desc = $tmp_obj->getDescription()))
282 $this->tpl->setCurrentBlock(
"description");
283 $this->tpl->setVariable(
"DESCRIPTION_DESK",$desc);
284 $this->tpl->parseCurrentBlock();
286 $this->tpl->setCurrentBlock(
"desk_row");
287 $this->tpl->setVariable(
"DESK_TITLE",$tmp_obj->getTitle());
289 $this->tpl->parseCurrentBlock();
292 $_SESSION[
'role_del_desk_items'] = $_POST[
'del_desk_item'];
301 #if (!$rbacsystem->checkAccess('edit_permission', $this->rolf_ref_id))
304 $this->ilias->raiseError($this->lng->txt(
"permission_denied"),$this->ilias->error_obj->MESSAGE);
307 if (!$rbacsystem->checkAccess(
'push_desktop_items',
USER_FOLDER_ID))
309 $this->ilias->raiseError($this->lng->txt(
"permission_denied"),$this->ilias->error_obj->MESSAGE);
312 if (!count(
$_SESSION[
'role_del_desk_items']))
321 include_once
'./classes/class.ilRoleDesktopItem.php';
325 foreach (
$_SESSION[
'role_del_desk_items'] as $role_item_id)
327 $role_desk_item_obj->
delete($role_item_id);
339 global $rbacsystem,
$tree;
341 include_once
'./classes/class.ilRoleDesktopItemSelector.php';
342 include_once
'./classes/class.ilRoleDesktopItem.php';
344 if(!$rbacsystem->checkAccess(
'push_desktop_items',
USER_FOLDER_ID))
346 #$this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
352 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.role_desktop_item_selector.html");
353 $this->
__showButton(
'listDesktopItems',$this->lng->txt(
'back'));
359 $exp->setExpand(
$_GET[
"role_desk_item_link_expand"] ?
$_GET[
"role_desk_item_link_expand"] : $tree->readRootId());
360 $exp->setExpandTarget($this->ctrl->getLinkTarget($this,
'selectDesktopItem'));
364 $output = $exp->getOutput();
365 $this->tpl->setVariable(
"EXPLORER",$output);
375 if (!$rbacsystem->checkAccess(
'push_desktop_items',
USER_FOLDER_ID))
377 $this->ilias->raiseError($this->lng->txt(
"permission_denied"),$this->ilias->error_obj->MESSAGE);
381 #if (!$rbacsystem->checkAccess('edit_permission', $this->rolf_ref_id))
384 $this->ilias->raiseError($this->lng->txt(
"permission_denied"),$this->ilias->error_obj->MESSAGE);
388 if (!isset(
$_GET[
'item_id']))
396 include_once
'./classes/class.ilRoleDesktopItem.php';
403 $this->ctrl->redirect($this,
'listDesktopItems');
415 if (!$rbacsystem->checkAccess(
'create_role', $this->rolf_ref_id))
417 $this->ilias->raiseError($this->lng->txt(
"permission_denied"),$this->ilias->error_obj->MESSAGE);
422 if ($this->rolf_ref_id == ROLE_FOLDER_ID)
424 $this->tpl->setCurrentBlock(
"allow_register");
425 $allow_register = (
$_SESSION[
"error_post_vars"][
"Fobject"][
"allow_register"]) ?
"checked=\"checked\"" :
"";
426 $this->tpl->setVariable(
"TXT_ALLOW_REGISTER",$this->lng->txt(
"allow_register"));
427 $this->tpl->setVariable(
"ALLOW_REGISTER",$allow_register);
428 $this->tpl->parseCurrentBlock();
430 $this->tpl->setCurrentBlock(
"assign_users");
431 $assign_users =
$_SESSION[
"error_post_vars"][
"Fobject"][
"assign_users"] ?
"checked=\"checked\"" :
"";
432 $this->tpl->setVariable(
"TXT_ASSIGN_USERS",$this->lng->txt(
"allow_assign_users"));
433 $this->tpl->setVariable(
"ASSIGN_USERS",$assign_users);
434 $this->tpl->parseCurrentBlock();
436 $this->tpl->setCurrentBlock(
"protect_permissions");
437 $protect_permissions =
$_SESSION[
"error_post_vars"][
"Fobject"][
"protect_permissions"] ?
"checked=\"checked\"" :
"";
438 $this->tpl->setVariable(
"TXT_PROTECT_PERMISSIONS",$this->lng->txt(
"role_protect_permissions"));
439 $this->tpl->setVariable(
"PROTECT_PERMISSIONS",$protect_permissions);
440 $this->tpl->parseCurrentBlock();
447 $this->tpl->setVariable(
"TXT_TITLE",$this->lng->txt(
"title"));
448 $this->tpl->setVariable(
"TXT_DESC",$this->lng->txt(
"desc"));
449 $this->ctrl->setParameter($this,
"new_type", $this->type);
450 $this->tpl->setVariable(
"FORMACTION",
451 $this->ctrl->getFormAction($this));
452 $this->tpl->setVariable(
"TXT_HEADER", $this->lng->txt($this->type.
"_new"));
453 $this->tpl->setVariable(
"TXT_CANCEL", $this->lng->txt(
"cancel"));
454 $this->tpl->setVariable(
"TXT_SUBMIT", $this->lng->txt($this->type.
"_add"));
455 $this->tpl->setVariable(
"CMD_SUBMIT",
"save");
457 $this->tpl->setVariable(
"TXT_REQUIRED_FLD", $this->lng->txt(
"required_field"));
467 global $rbacsystem, $rbacadmin, $rbacreview;
470 if (!$rbacsystem->checkAccess(
"create_role",$this->rolf_ref_id))
472 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_create_role"),$this->ilias->error_obj->MESSAGE);
476 if (empty($_POST[
"Fobject"][
"title"]))
478 $this->ilias->raiseError($this->lng->txt(
"fill_out_all_required_fields"),$this->ilias->error_obj->MESSAGE);
482 if (substr($_POST[
"Fobject"][
"title"],0,3) ==
"il_")
484 $this->ilias->raiseError($this->lng->txt(
"msg_role_reserved_prefix"),$this->ilias->error_obj->MESSAGE);
488 include_once(
"./Services/AccessControl/classes/class.ilObjRole.php");
492 $roleObj->setAllowRegister($_POST[
"Fobject"][
"allow_register"]);
493 $roleObj->toggleAssignUsersStatus($_POST[
"Fobject"][
"assign_users"]);
496 $rbacadmin->setProtected($this->rolf_ref_id,$roleObj->getId(),
ilUtil::tf2yn($_POST[
"Fobject"][
"protect_permissions"]));
499 $this->ctrl->returnToParent($this);
522 $access = $this->
checkAccess(
'visible,write',
'edit_permission');
526 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_perm"),$this->ilias->error_obj->MESSAGE);
529 $perm_def = $this->
object->__getPermissionDefinitions();
531 $rbac_objects =& $perm_def[0];
532 $rbac_operations =& $perm_def[1];
534 foreach ($rbac_objects as $key => $obj_data)
536 $rbac_objects[$key][
"name"] = $this->lng->txt(
"obj_".$obj_data[
"type"]);
537 $rbac_objects[$key][
"ops"] = $rbac_operations[$key];
541 if ($this->rolf_ref_id != ROLE_FOLDER_ID)
544 $parent_data = $this->tree->getParentNodeData($this->rolf_ref_id);
546 $subobj_data = $this->objDefinition->getSubObjectsRecursively($parent_data[
"type"]);
549 foreach ($rbac_objects as $key => $obj_data)
551 if ($obj_data[
"type"] ==
"rolf")
553 unset($rbac_objects[$key]);
557 if (!$subobj_data[$obj_data[
"type"]] and $parent_data[
"type"] != $obj_data[
"type"])
559 unset($rbac_objects[$key]);
576 foreach ($rbac_objects as $key => $obj_data)
578 $arr_selected = $rbacreview->getOperationsOfRole($this->object->getId(), $obj_data[
"type"],
$this->rolf_ref_id);
579 $arr_checked = array_intersect($arr_selected,array_keys($rbac_operations[$obj_data[
"obj_id"]]));
581 foreach ($rbac_operations[$obj_data[
"obj_id"]] as $operation)
584 if ($this->object->getId() == SYSTEM_ROLE_ID)
591 $checked = in_array($operation[
"ops_id"],$arr_checked);
596 $box = ilUtil::formCheckBox($checked,
"template_perm[".$obj_data[
"type"].
"][]",$operation[
"ops_id"],$disabled);
597 $output[
"perm"][$obj_data[
"obj_id"]][$operation[
"ops_id"]] = $box;
602 $output[
"col_anz"] = count($rbac_objects);
603 $output[
"txt_save"] = $this->lng->txt(
"save");
604 $output[
"check_recursive"] = ilUtil::formCheckBox(0,
"recursive",1);
605 $output[
"text_recursive"] = $this->lng->txt(
"change_existing_objects");
606 $output[
"text_recursive_desc"] = $this->lng->txt(
"change_existing_objects_desc");
608 $protected_disabled =
true;
610 if ($this->rolf_ref_id == ROLE_FOLDER_ID or $rbacreview->isAssignable($this->object->getId(),
$this->rolf_ref_id))
612 $protected_disabled =
false;
615 $output[
"check_protected"] = ilUtil::formCheckBox($rbacreview->isProtected($this->rolf_ref_id,$this->object->getId()),
618 $protected_disabled);
620 $output[
"text_protected"] = $this->lng->txt(
"role_protect_permissions");
621 $output[
"text_protected_desc"] = $this->lng->txt(
"role_protect_permissions_desc");
628 $output[
"message_middle"] = $this->lng->txt(
"adopt_perm_from_template");
631 if ($this->object->getId() == SYSTEM_ROLE_ID)
633 $output[
"adopt"] = array();
634 $output[
"sysrole_msg"] = $this->lng->txt(
"msg_sysrole_not_editable");
639 $parent_role_ids = $rbacreview->getParentRoleIds($this->rolf_ref_id,
true);
641 foreach($parent_role_ids as $id => $tmp)
653 foreach($sorted_ids as $id)
655 $par = $parent_role_ids[$id];
656 #foreach ($sorted_roles as $par)
658 if ($par[
"obj_id"] != SYSTEM_ROLE_ID)
661 $output[
"adopt"][$key][
"css_row_adopt"] = ($key % 2 == 0) ?
"tblrow1" :
"tblrow2";
662 $output[
"adopt"][$key][
"check_adopt"] = $radio;
663 $output[
"adopt"][$key][
"role_id"] = $par[
"obj_id"];
664 $output[
"adopt"][$key][
"type"] = ($par[
"type"] ==
'role' ?
'Role' :
'Template');
665 $output[
"adopt"][$key][
"role_name"] = $par[
"title"];
666 $output[
"adopt"][$key][
"role_desc"] = $par[
"desc"];
671 $output[
"formaction_adopt"] = $this->ctrl->getFormAction($this);
675 $output[
"formaction"] = $this->ctrl->getFormAction($this);
677 $this->data = $output;
684 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.adm_perm_role.html');
686 foreach ($rbac_objects as $obj_data)
689 $this->tpl->setCurrentBlock(
"object_operations");
693 foreach ($obj_data[
"ops"] as $operation)
695 $ops_ids[] = $operation[
"ops_id"];
698 $css_row =
"tblrow1";
699 $this->tpl->setVariable(
"CSS_ROW",$css_row);
700 $this->tpl->setVariable(
"PERMISSION",$operation[
"name"]);
701 if (substr($operation[
"title"], 0, 7) ==
"create_")
703 if ($this->objDefinition->getDevMode(substr($operation[
"title"], 7, strlen($operation[
"title"]) -7)))
705 $this->tpl->setVariable(
"TXT_NOT_IMPL",
"(".$this->lng->txt(
"not_implemented_yet").
")");
708 $this->tpl->setVariable(
"CHECK_PERMISSION",$this->data[
"perm"][$obj_data[
"obj_id"]][$operation[
"ops_id"]]);
709 $this->tpl->setVariable(
"LABEL_ID",
"template_perm_".$obj_data[
"type"].
"_".$operation[
"ops_id"]);
710 $this->tpl->parseCurrentBlock();
714 $this->tpl->setCurrentBlock(
"object_type");
717 if ($objDefinition->isSystemObject($obj_data[
"type"]) &&
718 $obj_data[
"type"] !=
"root")
720 $this->tpl->setVariable(
"TXT_ADMINIS",
"(".$this->lng->txt(
"administration").
") ");
723 $this->tpl->setVariable(
"TXT_OBJ_TYPE",$obj_data[
"name"]);
726 if ($this->objDefinition->getDevMode($obj_data[
"type"]))
728 $this->tpl->setVariable(
"TXT_NOT_IMPL",
"(".$this->lng->txt(
"not_implemented_yet").
")");
730 else if ($obj_data[
"type"] ==
"icrs" and !$this->ilias->getSetting(
"ilinc_active"))
732 $this->tpl->setVariable(
"TXT_NOT_IMPL",
"(".$this->lng->txt(
"not_enabled_or_configured").
")");
736 $this->tpl->setVariable(
"OBJ_TYPE",$obj_data[
"type"]);
737 $this->tpl->setVariable(
"CHANGE_PERM_OBJ_TYPE_DESC",$this->lng->txt(
"change_existing_object_type_desc"));
740 if ($objDefinition->isSystemObject($obj_data[
"type"]))
742 $this->tpl->setVariable(
"CHANGE_PERM_OBJ_TYPE",$this->lng->txt(
"change_existing_prefix_single").
" ".$this->lng->txt(
"obj_".$obj_data[
"type"]).
" ".$this->lng->txt(
"change_existing_suffix_single"));
747 $this->tpl->setVariable(
"CHANGE_PERM_OBJ_TYPE",$this->lng->txt(
"change_existing_prefix").
" ".$this->lng->txt(
"objs_".$obj_data[
"type"]).
" ".$this->lng->txt(
"change_existing_suffix"));
751 $this->tpl->setVariable(
"JS_VARNAME",
"template_perm_".$obj_data[
"type"]);
753 $this->tpl->setVariable(
"TXT_CHECKALL", $this->lng->txt(
"check_all"));
754 $this->tpl->setVariable(
"TXT_UNCHECKALL", $this->lng->txt(
"uncheck_all"));
756 $this->tpl->parseCurrentBlock();
761 if ($this->object->getId() != SYSTEM_ROLE_ID)
764 foreach ($this->data[
"adopt"] as $key => $value)
766 $this->tpl->setCurrentBlock(
"ADOPT_PERM_ROW");
767 $this->tpl->setVariable(
"CSS_ROW_ADOPT",$value[
"css_row_adopt"]);
768 $this->tpl->setVariable(
"CHECK_ADOPT",$value[
"check_adopt"]);
769 $this->tpl->setVariable(
"LABEL_ID",$value[
"role_id"]);
770 $this->tpl->setVariable(
"TYPE",$value[
"type"]);
771 $this->tpl->setVariable(
"ROLE_NAME",$value[
"role_name"]);
772 if(strlen($value[
'role_desc']))
774 $this->tpl->setVariable(
'ROLE_DESC',$value[
'role_desc']);
777 $this->tpl->parseCurrentBlock();
780 $this->tpl->setCurrentBlock(
"ADOPT_PERM_FORM");
781 $this->tpl->setVariable(
"MESSAGE_MIDDLE",$this->data[
"message_middle"]);
782 $this->tpl->setVariable(
"FORMACTION_ADOPT",$this->data[
"formaction_adopt"]);
783 $this->tpl->setVariable(
"ADOPT",$this->lng->txt(
'copy'));
784 $this->tpl->parseCurrentBlock();
787 $this->tpl->setCurrentBlock(
"tblfooter_special_options");
788 $this->tpl->setVariable(
"TXT_PERM_SPECIAL_OPTIONS",$this->lng->txt(
"perm_special_options"));
789 $this->tpl->parseCurrentBlock();
791 $this->tpl->setCurrentBlock(
"tblfooter_recursive");
792 $this->tpl->setVariable(
"COL_ANZ",3);
793 $this->tpl->setVariable(
"CHECK_RECURSIVE",$this->data[
"check_recursive"]);
794 $this->tpl->setVariable(
"TXT_RECURSIVE",$this->data[
"text_recursive"]);
795 $this->tpl->setVariable(
"TXT_RECURSIVE_DESC",$this->data[
"text_recursive_desc"]);
796 $this->tpl->parseCurrentBlock();
798 $this->tpl->setCurrentBlock(
"tblfooter_protected");
799 $this->tpl->setVariable(
"COL_ANZ",3);
800 $this->tpl->setVariable(
"CHECK_PROTECTED",$this->data[
"check_protected"]);
801 $this->tpl->setVariable(
"TXT_PROTECTED",$this->data[
"text_protected"]);
802 $this->tpl->setVariable(
"TXT_PROTECTED_DESC",$this->data[
"text_protected_desc"]);
803 $this->tpl->parseCurrentBlock();
805 $this->tpl->setCurrentBlock(
"tblfooter_standard");
806 $this->tpl->setVariable(
"COL_ANZ_PLUS",4);
807 $this->tpl->setVariable(
"TXT_SAVE",$this->data[
"txt_save"]);
808 $this->tpl->parseCurrentBlock();
813 $this->tpl->setCurrentBlock(
"tblfooter_sysrole");
814 $this->tpl->setVariable(
"COL_ANZ_SYS",3);
815 $this->tpl->parseCurrentBlock();
818 $this->tpl->setCurrentBlock(
"sysrole_msg");
819 $this->tpl->setVariable(
"TXT_SYSROLE_MSG",$this->data[
"sysrole_msg"]);
820 $this->tpl->parseCurrentBlock();
823 $this->tpl->setCurrentBlock(
"adm_content");
824 $this->tpl->setVariable(
"TBL_TITLE_IMG",
ilUtil::getImagePath(
"icon_".$this->object->getType().
".gif"));
825 $this->tpl->setVariable(
"TBL_TITLE_IMG_ALT",$this->lng->txt($this->object->getType()));
827 $this->tpl->setVariable(
"TBL_HELP_LINK",
"tbl_help.php");
828 $this->tpl->setVariable(
"TBL_HELP_IMG_ALT",$this->lng->txt(
"help"));
831 $global_roles = $rbacreview->getGlobalRoles();
833 if (in_array($this->object->getId(),$global_roles))
840 if($rolf = $rbacreview->getFoldersAssignedToRole($this->object->getId(),
true))
842 $parent_node = $this->tree->getParentNodeData($rolf[0]);
843 $desc = $this->lng->txt(
"obj_".$parent_node[
'type']).
" (#".$parent_node[
'obj_id'].
") : ".$parent_node[
'title'];
847 $description =
" <span class=\"small\">(".$desc.
")</span>";
850 if (substr($this->object->getTitle(),0,3) ==
"il_")
856 $title = $this->
object->getTitle();
859 $this->tpl->setVariable(
"TBL_TITLE",
$title.$description);
862 $pid = $tree->getParentId($this->rolf_ref_id);
864 if ($this->rolf_ref_id != ROLE_FOLDER_ID)
866 $info = sprintf($this->lng->txt(
"perm_role_info_1"),
867 $this->
object->getTitle(), $ptitle).
" ".
868 sprintf($this->lng->txt(
"perm_role_info_2"),
869 $this->
object->getTitle(), $ptitle);
873 $info = sprintf($this->lng->txt(
"perm_role_info_glob_1"),
874 $this->
object->getTitle(), $ptitle).
" ".
875 sprintf($this->lng->txt(
"perm_role_info_glob_2"),
876 $this->
object->getTitle(), $ptitle);
878 $this->tpl->setVariable(
"TXT_TITLE_INFO", $info);
880 $this->tpl->setVariable(
"TXT_PERMISSION",$this->data[
"txt_permission"]);
881 $this->tpl->setVariable(
"FORMACTION",$this->data[
"formaction"]);
882 $this->tpl->parseCurrentBlock();
907 $access = $this->
checkAccess(
'visible,write',
'edit_permission');
911 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_perm"),$this->ilias->error_obj->MESSAGE);
917 if (empty($_POST[
"template_perm"]))
919 $_POST[
"template_perm"] = array();
922 foreach ($_POST[
"template_perm"] as $key => $ops_array)
925 $rbacadmin->setRolePermission($this->object->getId(), $key, $ops_array,
$this->rolf_ref_id);
929 $this->
object->update();
933 if ($_POST[
"recursive"] or is_array($_POST[
"recursive_list"]))
936 if ($this->rolf_ref_id == ROLE_FOLDER_ID)
938 $node_id = ROOT_FOLDER_ID;
942 $node_id = $this->tree->getParentId($this->rolf_ref_id);
947 #$node_data = $this->tree->getNodeData($node_id);
948 #$subtree_nodes = $this->tree->getSubTree($node_data);
950 $subtree_nodes = $tree->getRbacSubtreeInfo($node_id);
953 $all_parent_obj_of_rolf = $rbacreview->getObjectsWithStopedInheritance($this->object->getId());
956 if ($this->rolf_ref_id == ROLE_FOLDER_ID)
958 $key = array_keys($all_parent_obj_of_rolf,SYSTEM_FOLDER_ID);
962 $key = array_keys($all_parent_obj_of_rolf,$node_id);
965 unset($all_parent_obj_of_rolf[$key[0]]);
969 foreach ($subtree_nodes as $node)
973 if (in_array($node[
"child"],$all_parent_obj_of_rolf))
981 $valid_nodes[] = $node;
985 if (($node[
"lft"] > $lft) && ($node[
"rgt"] < $rgt))
993 if (in_array($node[
"child"],$all_parent_obj_of_rolf))
1001 $valid_nodes[] = $node;
1007 foreach ($valid_nodes as $key => $node)
1010 if (is_array($_POST[
"recursive_list"]) and !in_array($node[
"type"],$_POST[
"recursive_list"]))
1012 unset($valid_nodes[$key]);
1016 $node_ids[] = $node[
"child"];
1017 $valid_nodes[$key][
"perms"] = $_POST[
"template_perm"][$node[
"type"]];
1030 if (!empty($node_ids))
1033 $rbacadmin->revokePermissionList($node_ids,$this->object->getId());
1036 foreach ($valid_nodes as $node)
1038 if (is_array($node[
"perms"]))
1040 $rbacadmin->grantPermission($this->object->getId(),$node[
"perms"],$node[
"child"]);
1049 if ($this->rolf_ref_id == ROLE_FOLDER_ID or $rbacreview->isAssignable($this->object->getId(),
$this->rolf_ref_id))
1051 $rbacadmin->setProtected($this->rolf_ref_id,$this->object->getId(),
ilUtil::tf2yn($_POST[
'protected']));
1055 $this->ctrl->redirect($this,
"perm");
1066 global $rbacadmin, $rbacsystem, $rbacreview,
$tree;
1068 if(!$_POST[
'adopt'])
1087 $access = $this->
checkAccess(
'visible,write',
'edit_permission');
1090 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_perm"),$this->ilias->error_obj->MESSAGE);
1093 if ($this->object->getId() == $_POST[
"adopt"])
1100 $parentRoles = $rbacreview->getParentRoleIds($this->rolf_ref_id,
true);
1101 $rbacadmin->copyRoleTemplatePermissions(
1103 $parentRoles[$_POST[
"adopt"]][
"parent"],
1105 $this->object->getId(),
1109 $this->
object->update();
1112 $obj_data =& $this->ilias->obj_factory->getInstanceByObjId($_POST[
"adopt"]);
1113 ilUtil::sendInfo($this->lng->txt(
"msg_perm_adopted_from1").
" '".$obj_data->getTitle().
"'.<br/>".
1114 $this->lng->txt(
"msg_perm_adopted_from2"),
true);
1117 $this->ctrl->redirect($this,
"perm");
1137 global $rbacsystem, $rbacadmin, $rbacreview;
1139 #if (!$rbacsystem->checkAccess("edit_userassignment", $this->rolf_ref_id))
1140 if(!$this->
checkAccess(
'edit_userassignment',
'edit_permission'))
1142 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_assign_user_to_role"),$this->ilias->error_obj->MESSAGE);
1146 $this->rolf_ref_id != ROLE_FOLDER_ID)
1148 $this->ilias->raiseError($this->lng->txt(
"err_role_not_assignable"),$this->ilias->error_obj->MESSAGE);
1151 if (!isset($_POST[
"user"]))
1159 $selected_users = $_POST[
"user"];
1160 $assigned_users_all = $rbacreview->assignedUsers($this->object->getId());
1163 $assigned_users_new = array_diff($selected_users,array_intersect($selected_users,$assigned_users_all));
1166 if (count($assigned_users_new) == 0)
1175 foreach ($assigned_users_new as
$user)
1177 $rbacadmin->assignUser($this->object->getId(),
$user,
false);
1181 $this->
object->update();
1185 $this->ctrl->redirect($this,
'userassignment');
1195 global $rbacsystem, $rbacadmin, $rbacreview;
1197 #if (!$rbacsystem->checkAccess("edit_userassignment", $this->rolf_ref_id))
1198 if(!$this->
checkAccess(
'edit_userassignment',
'edit_permission'))
1200 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_assign_user_to_role"),$this->ilias->error_obj->MESSAGE);
1209 $selected_users = ($_POST[
"user_id"]) ? $_POST[
"user_id"] : array(
$_GET[
"user_id"]);
1211 if ($selected_users[0]=== NULL)
1213 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
1217 if ($this->object->getId() == SYSTEM_ROLE_ID)
1219 if ($admin = array_search(SYSTEM_USER_ID,$selected_users) !==
false)
1220 unset($selected_users[$admin]);
1224 $last_role = array();
1225 $global_roles = $rbacreview->getGlobalRoles();
1227 foreach ($selected_users as
$user)
1229 $assigned_roles = $rbacreview->assignedRoles($user);
1230 $assigned_global_roles = array_intersect($assigned_roles,$global_roles);
1232 if (count($assigned_roles) == 1 or (count($assigned_global_roles) == 1 and in_array($this->object->getId(),$assigned_global_roles)))
1234 $userObj = $this->ilias->obj_factory->getInstanceByObjId($user);
1235 $last_role[
$user] = $userObj->getFullName();
1241 if (count($last_role) > 0)
1243 $user_list = implode(
", ",$last_role);
1244 $this->ilias->raiseError($this->lng->txt(
"msg_is_last_role").
": ".$user_list.
"<br/>".$this->lng->txt(
"msg_min_one_role").
"<br/>".$this->lng->txt(
"action_aborted"),$this->ilias->error_obj->MESSAGE);
1248 foreach ($selected_users as $user)
1250 $rbacadmin->deassignUser($this->object->getId(),
$user);
1254 $this->
object->update();
1258 $this->ctrl->redirect($this,
'userassignment');
1268 global $rbacsystem, $rbacreview, $rbacadmin,
$tree;
1281 $access = $this->
checkAccess(
'write',
'edit_permission');
1284 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_modify_role"),$this->ilias->error_obj->MESSAGE);
1287 if (substr($this->object->getTitle(),0,3) !=
"il_")
1290 if (empty($_POST[
"Fobject"][
"title"]))
1292 $this->ilias->raiseError($this->lng->txt(
"fill_out_all_required_fields"),$this->ilias->error_obj->MESSAGE);
1296 if (substr($_POST[
"Fobject"][
"title"],0,3) ==
"il_")
1298 $this->ilias->raiseError($this->lng->txt(
"msg_role_reserved_prefix"),$this->ilias->error_obj->MESSAGE);
1309 if ($_POST[
"Fobject"][
"allow_register"] ==
"")
1311 $roles_allowed = $this->
object->_lookupRegisterAllowed();
1313 if (count($roles_allowed) == 1 and $roles_allowed[0][
'id'] == $this->object->getId())
1315 $this->ilias->raiseError($this->lng->txt(
"msg_last_role_for_registration"),$this->ilias->error_obj->MESSAGE);
1319 $this->
object->setAllowRegister($_POST[
"Fobject"][
"allow_register"]);
1320 $this->
object->toggleAssignUsersStatus($_POST[
"Fobject"][
"assign_users"]);
1321 $rbacadmin->setProtected($this->rolf_ref_id,$this->object->getId(),
ilUtil::tf2yn($_POST[
"Fobject"][
"protect_permissions"]));
1322 $this->
object->update();
1326 $this->ctrl->redirect($this,
'edit');
1336 global $rbacsystem, $rbacreview;
1338 #if (!$rbacsystem->checkAccess("write", $this->rolf_ref_id))
1339 if(!$this->
checkAccess(
'write',
'edit_permission'))
1341 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_write"),$this->ilias->error_obj->MESSAGE);
1349 if (substr($this->object->getTitle(
false),0,3) !=
"il_")
1355 $allow_register = (
$_SESSION[
"error_post_vars"][
"Fobject"][
"allow_register"]) ?
"checked=\"checked\"" :
"";
1356 $assign_users = (
$_SESSION[
"error_post_vars"][
"Fobject"][
"assign_users"]) ?
"checked=\"checked\"" :
"";
1357 $protect_permissions = (
$_SESSION[
"error_post_vars"][
"Fobject"][
"protect_permissions"]) ?
"checked=\"checked\"" :
"";
1361 if (substr($this->object->getTitle(),0,3) !=
"il_")
1367 $allow_register = ($this->
object->getAllowRegister()) ?
"checked=\"checked\"" :
"";
1368 $assign_users = $this->
object->getAssignUsersStatus() ?
"checked=\"checked\"" :
"";
1369 $protect_permissions = $rbacreview->isProtected($this->rolf_ref_id,$this->object->getId()) ?
"checked=\"checked\"" :
"";
1373 $obj_str =
"&obj_id=".$this->obj_id;
1375 $this->tpl->setVariable(
"TXT_TITLE",$this->lng->txt(
"title"));
1376 $this->tpl->setVariable(
"TXT_DESC",$this->lng->txt(
"desc"));
1379 $global_roles = $rbacreview->getGlobalRoles();
1381 $this->tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
1382 $this->tpl->setVariable(
"TXT_HEADER", $this->lng->txt($this->object->getType().
"_edit"));
1383 $this->tpl->setVariable(
"TARGET", $this->
getTargetFrame(
"update"));
1384 $this->tpl->setVariable(
"TXT_CANCEL", $this->lng->txt(
"cancel"));
1385 $this->tpl->setVariable(
"TXT_SUBMIT", $this->lng->txt(
"save"));
1386 $this->tpl->setVariable(
"CMD_SUBMIT",
"update");
1387 $this->tpl->setVariable(
"TXT_REQUIRED_FLD", $this->lng->txt(
"required_field"));
1389 if (substr($this->object->getTitle(),0,3) ==
"il_")
1391 $this->tpl->setVariable(
"SHOW_TITLE",
ilObjRole::_getTranslation($this->object->getTitle()).
" (".$this->object->getTitle().
")");
1393 $rolf = $rbacreview->getFoldersAssignedToRole($this->object->getId(),
true);
1394 $parent_node = $this->tree->getParentNodeData($rolf[0]);
1396 $this->tpl->setVariable(
"SHOW_DESC",$this->lng->txt(
"obj_".$parent_node[
'type']).
" (".$parent_node[
'obj_id'].
") <br/>".$parent_node[
'title']);
1398 $this->tpl->setVariable(
"TXT_CANCEL", $this->lng->txt(
"cancel"));
1399 $this->tpl->setVariable(
"TXT_SUBMIT", $this->lng->txt(
"back"));
1400 $this->tpl->setVariable(
"CMD_SUBMIT",
"cancel");
1403 if ($this->object->getId() != ANONYMOUS_ROLE_ID and
1404 $this->
object->getId() != SYSTEM_ROLE_ID and
1405 in_array($this->object->getId(),$global_roles))
1407 $this->tpl->setCurrentBlock(
"allow_register");
1408 $this->tpl->setVariable(
"TXT_ALLOW_REGISTER",$this->lng->txt(
"allow_register"));
1409 $this->tpl->setVariable(
"ALLOW_REGISTER",$allow_register);
1410 $this->tpl->parseCurrentBlock();
1412 $this->tpl->setCurrentBlock(
"assign_users");
1413 $this->tpl->setVariable(
"TXT_ASSIGN_USERS",$this->lng->txt(
'allow_assign_users'));
1414 $this->tpl->setVariable(
"ASSIGN_USERS",$assign_users);
1415 $this->tpl->parseCurrentBlock();
1417 $this->tpl->setCurrentBlock(
"protect_permissions");
1418 $this->tpl->setVariable(
"TXT_PROTECT_PERMISSIONS",$this->lng->txt(
'role_protect_permissions'));
1419 $this->tpl->setVariable(
"PROTECT_PERMISSIONS",$protect_permissions);
1420 $this->tpl->parseCurrentBlock();
1429 global $rbacreview, $rbacsystem;
1432 if(!$this->
checkAccess(
'edit_userassignment',
'edit_permission'))
1434 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_assign_user_to_role"),$this->ilias->error_obj->MESSAGE);
1436 $assigned_users = $rbacreview->assignedUsers($this->object->getId(),array(
"login",
"firstname",
"lastname",
"usr_id"));
1439 $val_contact = $this->lng->txt(
"message");
1440 $val_change = $this->lng->txt(
"edit");
1441 $val_leave = $this->lng->txt(
"remove");
1442 $val_contact_desc = $this->lng->txt(
"role_user_send_mail");
1443 $val_change_desc = $this->lng->txt(
"role_user_edit");
1444 $val_leave_desc = $this->lng->txt(
"role_user_deassign");
1447 foreach ($assigned_users as
$user)
1449 $link_contact =
"ilias.php?baseClass=ilMailGUI&type=new&rcp_to=".urlencode($user[
"login"]);
1451 if (
$_GET[
"admin_mode"] ==
"settings"
1452 &&
$_GET[
"ref_id"] != SYSTEM_FOLDER_ID)
1454 $this->ctrl->setParameterByClass(
"ilobjusergui",
"ref_id", 7);
1455 $this->ctrl->setParameterByClass(
"ilobjusergui",
"obj_id", $user[
"usr_id"]);
1456 $link_change = $this->ctrl->getLinkTargetByClass(array(
"iladministrationgui",
"ilobjusergui"),
"view");
1457 $this->ctrl->setParameterByClass(
"ilobjusergui",
"ref_id",
$_GET[
"ref_id"]);
1460 $this->ctrl->setParameter($this,
"user_id", $user[
"usr_id"]);
1461 $link_leave = $this->ctrl->getLinkTarget($this,
"deassignUser");
1463 $member_functions =
"";
1466 if ($this->object->getId() != ANONYMOUS_ROLE_ID or $user[
"usr_id"] != ANONYMOUS_USER_ID)
1469 $member_functions =
"<a class=\"il_ContainerItemCommand\" href=\"".$link_contact.
"\" title=\"".$val_contact_desc.
"\">".$val_contact.
"</a>";
1471 if (strtolower(
$_GET[
"baseClass"]) ==
'iladministrationgui' &&
$_GET[
"admin_mode"] ==
"settings")
1473 $member_functions .=
" <a class=\"il_ContainerItemCommand\" href=\"".$link_change.
"\" title=\"".$val_change_desc.
"\">".$val_change.
"</a>";
1476 if ($this->object->getId() != SYSTEM_ROLE_ID or $user[
"usr_id"] != SYSTEM_USER_ID)
1478 $member_functions .=
" <a class=\"il_ContainerItemCommand\" href=\"".$link_leave.
"\" title=\"".$val_leave_desc.
"\">".$val_leave.
"</a>";
1483 if (($this->object->getId() == SYSTEM_ROLE_ID and $user[
"usr_id"] == SYSTEM_USER_ID)
1484 or ($this->object->getId() == ANONYMOUS_ROLE_ID and $user[
"usr_id"] == ANONYMOUS_USER_ID))
1486 $result_set[$counter][] =
"";
1490 $result_set[$counter][] = ilUtil::formCheckBox(0,
"user_id[]",$user[
"usr_id"]);
1493 $user_ids[$counter] = $user[
"usr_id"];
1495 $result_set[$counter][] = $user[
"login"];
1496 $result_set[$counter][] = $user[
"firstname"];
1497 $result_set[$counter][] = $user[
"lastname"];
1498 $result_set[$counter][] = $member_functions;
1502 unset($member_functions);
1512 $actions = array(
"deassignUser" => $this->lng->txt(
"remove"));
1515 $tpl =& $tbl->getTemplateObject();
1517 $this->
__showButton(
'mailToRole',$this->lng->txt(
'role_mailto'),
'target=\'_blank\'');
1519 $tpl->setCurrentBlock(
"tbl_form_header");
1520 $tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
1521 $tpl->parseCurrentBlock();
1523 $tpl->setCurrentBlock(
"tbl_action_row");
1525 $tpl->setCurrentBlock(
"plain_button");
1526 $tpl->setVariable(
"PBTN_NAME",
"searchUserForm");
1527 $tpl->setVariable(
"PBTN_VALUE",$this->lng->txt(
"role_add_user"));
1528 $tpl->parseCurrentBlock();
1529 $tpl->setCurrentBlock(
"plain_buttons");
1530 $tpl->parseCurrentBlock();
1532 $tpl->setVariable(
"COLUMN_COUNTS",5);
1535 foreach (
$actions as $name => $value)
1537 $tpl->setCurrentBlock(
"tbl_action_btn");
1538 $tpl->setVariable(
"BTN_NAME",$name);
1539 $tpl->setVariable(
"BTN_VALUE",$value);
1540 $tpl->parseCurrentBlock();
1543 if (!empty($a_user_ids))
1546 $tpl->setCurrentBlock(
"tbl_action_toggle_checkboxes");
1547 $tpl->setVariable(
"JS_VARNAME",
"user_id");
1549 $tpl->setVariable(
"TXT_CHECKALL", $this->lng->txt(
"check_all"));
1550 $tpl->setVariable(
"TXT_UNCHECKALL", $this->lng->txt(
"uncheck_all"));
1551 $tpl->parseCurrentBlock();
1554 $tpl->setVariable(
"TPLPATH",$this->tpl->tplPath);
1555 $this->ctrl->setParameter($this,
"cmd",
"userassignment");
1558 $tbl->setTitle($this->lng->txt(
"assigned_users"),
"icon_usr.gif",$this->lng->txt(
"users"));
1561 $tbl->setHeaderNames(array(
"",$this->lng->txt(
"username"),$this->lng->txt(
"firstname"),
1562 $this->lng->txt(
"lastname"),$this->lng->txt(
"grp_options")));
1563 $tbl->setHeaderVars(array(
"",
"login",
"firstname",
"lastname",
"functions"),
1564 $this->ctrl->getParameterArray($this,
"",
false));
1565 $tbl->setColumnWidth(array(
"",
"20%",
"25%",
"25%",
"30%"));
1569 $this->tpl->setVariable(
"ADM_CONTENT",$tbl->tpl->get());
1576 include_once
"./Services/Table/classes/class.ilTableGUI.php";
1586 $order =
$_GET[
"sort_by"] ?
$_GET[
"sort_by"] :
"title";
1590 $order =
$_GET[
"sort_by"] ?
$_GET[
"sort_by"] :
"title";
1595 if (
$_GET[
"sort_by"] ==
"title" or empty(
$_GET[
"sort_by"]))
1597 $_GET[
"sort_by"] =
"login";
1599 $order =
$_GET[
"sort_by"];
1603 $tbl->setOrderColumn($order);
1604 $tbl->setOrderDirection(
$_GET[
"sort_order"]);
1605 $tbl->setOffset(
$_GET[
"offset"]);
1606 $tbl->setLimit(
$_GET[
"limit"]);
1607 $tbl->setFooter(
"tblfooter",$this->lng->txt(
"previous"),$this->lng->txt(
"next"));
1608 $tbl->setData($result_set);
1616 if(!$this->
checkAccess(
'edit_userassignment',
'edit_permission'))
1618 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_assign_user_to_role"),$this->ilias->error_obj->MESSAGE);
1621 $this->lng->loadLanguageModule(
'search');
1623 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.role_users_search.html");
1625 $this->tpl->setVariable(
"F_ACTION",$this->ctrl->getFormAction($this));
1626 $this->tpl->setVariable(
"SEARCH_ASSIGN_USR",$this->lng->txt(
"role_search_users"));
1627 $this->tpl->setVariable(
"SEARCH_SEARCH_TERM",$this->lng->txt(
"search_search_term"));
1628 $this->tpl->setVariable(
"SEARCH_VALUE",
$_SESSION[
"role_search_str"] ?
$_SESSION[
"role_search_str"] :
"");
1629 $this->tpl->setVariable(
"SEARCH_FOR",$this->lng->txt(
"exc_search_for"));
1630 $this->tpl->setVariable(
"SEARCH_ROW_TXT_USER",$this->lng->txt(
"exc_users"));
1631 $this->tpl->setVariable(
"SEARCH_ROW_TXT_ROLE",$this->lng->txt(
"exc_roles"));
1632 $this->tpl->setVariable(
"SEARCH_ROW_TXT_GROUP",$this->lng->txt(
"exc_groups"));
1633 $this->tpl->setVariable(
"BTN2_VALUE",$this->lng->txt(
"cancel"));
1634 $this->tpl->setVariable(
"BTN1_VALUE",$this->lng->txt(
"search"));
1636 $usr = ($_POST[
"search_for"] ==
"usr" || $_POST[
"search_for"] ==
"") ? 1 : 0;
1637 $grp = ($_POST[
"search_for"] ==
"grp") ? 1 : 0;
1638 $role = ($_POST[
"search_for"] ==
"role") ? 1 : 0;
1649 unset(
$_SESSION[
"role_delete_member_ids"]);
1650 unset(
$_SESSION[
"role_delete_subscriber_ids"]);
1666 if (
$_GET[
"new_type"] !=
"role")
1668 $this->ctrl->redirect($this,
"userassignment");
1672 $this->ctrl->redirectByClass(
"ilobjrolefoldergui",
"view");
1678 global $rbacsystem,
$tree;
1680 #if (!$rbacsystem->checkAccess("edit_userassignment", $this->rolf_ref_id))
1681 if(!$this->
checkAccess(
'edit_userassignment',
'edit_permission'))
1683 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_assign_user_to_role"),$this->ilias->error_obj->MESSAGE);
1686 $_SESSION[
"role_search_str"] = $_POST[
"search_str"] = $_POST[
"search_str"] ? $_POST[
"search_str"] :
$_SESSION[
"role_search_str"];
1687 $_SESSION[
"role_search_for"] = $_POST[
"search_for"] = $_POST[
"search_for"] ? $_POST[
"search_for"] :
$_SESSION[
"role_search_for"];
1689 if (!isset($_POST[
"search_for"]) or !isset($_POST[
"search_str"]))
1705 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.role_usr_selection.html");
1706 $this->
__showButton(
"searchUserForm",$this->lng->txt(
"role_new_search"));
1709 $f_result = array();
1711 switch($_POST[
"search_for"])
1721 $user_ids[$counter] = $user[
"id"];
1724 $f_result[$counter][] = $tmp_obj->getLogin();
1725 $f_result[$counter][] = $tmp_obj->getFirstname();
1726 $f_result[$counter][] = $tmp_obj->getLastname();
1739 if ($role[
"id"] == ANONYMOUS_ROLE_ID)
1750 if ($tmp_obj->getCountMembers() == 0)
1755 $role_ids[$counter] = $role[
"id"];
1758 $f_result[$counter][] = array($tmp_obj->getTitle(),$tmp_obj->getDescription());
1759 $f_result[$counter][] = $tmp_obj->getCountMembers();
1772 if(!$tree->isInTree($group[
"id"]))
1783 if ($tmp_obj->getId() == $this->
object->getId())
1788 $grp_ids[$counter] = $group[
"id"];
1791 $f_result[$counter][] = array($tmp_obj->getTitle(),$tmp_obj->getDescription());
1792 $f_result[$counter][] = $tmp_obj->getCountMembers();
1805 include_once(
"./classes/class.ilSearch.php");
1807 $this->lng->loadLanguageModule(
"content");
1809 $search->setPerformUpdate(
false);
1811 $search->setCombination(
"and");
1812 $search->setSearchFor(array(0 => $a_search_for));
1813 $search->setSearchType(
'new');
1815 if ($search->validate($message))
1817 $search->performSearch();
1822 $this->ctrl->redirect($this,
"searchUserForm");
1825 return $search->getResultByType($a_search_for);
1830 $return_to =
"searchUserForm";
1832 if ($a_cmd ==
"listUsersRole" or $a_cmd ==
"listUsersGroup")
1834 $return_to =
"search";
1838 $tpl =& $tbl->getTemplateObject();
1841 $tpl->setCurrentBlock(
"tbl_form_header");
1842 $tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
1843 $tpl->parseCurrentBlock();
1845 $tpl->setCurrentBlock(
"tbl_action_btn");
1846 $tpl->setVariable(
"BTN_NAME",$return_to);
1847 $tpl->setVariable(
"BTN_VALUE",$this->lng->txt(
"back"));
1848 $tpl->parseCurrentBlock();
1850 $tpl->setCurrentBlock(
"tbl_action_btn");
1851 $tpl->setVariable(
"BTN_NAME",
"assignUser");
1852 $tpl->setVariable(
"BTN_VALUE",$this->lng->txt(
"add"));
1853 $tpl->parseCurrentBlock();
1855 if (!empty($a_user_ids))
1858 $tpl->setCurrentBlock(
"tbl_action_toggle_checkboxes");
1859 $tpl->setVariable(
"JS_VARNAME",
"user");
1861 $tpl->setVariable(
"TXT_CHECKALL", $this->lng->txt(
"check_all"));
1862 $tpl->setVariable(
"TXT_UNCHECKALL", $this->lng->txt(
"uncheck_all"));
1863 $tpl->parseCurrentBlock();
1866 $tpl->setCurrentBlock(
"tbl_action_row");
1867 $tpl->setVariable(
"COLUMN_COUNTS",4);
1869 $tpl->parseCurrentBlock();
1871 $tbl->setTitle($this->lng->txt(
"role_header_edit_users"),
"icon_usr.gif",$this->lng->txt(
"role_header_edit_users"));
1872 $tbl->setHeaderNames(array(
"",
1873 $this->lng->txt(
"username"),
1874 $this->lng->txt(
"firstname"),
1875 $this->lng->txt(
"lastname")));
1876 $tbl->setHeaderVars(array(
"",
1880 $this->ctrl->getParameterArray($this,$a_cmd,
false));
1887 $tbl->setColumnWidth(array(
"",
"33%",
"33%",
"33%"));
1892 $this->tpl->setVariable(
"SEARCH_RESULT_TABLE",$tbl->tpl->get());
1900 $tpl =& $tbl->getTemplateObject();
1902 $tpl->setCurrentBlock(
"tbl_form_header");
1903 $tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
1904 $tpl->parseCurrentBlock();
1906 $tpl->setCurrentBlock(
"tbl_action_btn");
1907 $tpl->setVariable(
"BTN_NAME",
"searchUserForm");
1908 $tpl->setVariable(
"BTN_VALUE",$this->lng->txt(
"back"));
1909 $tpl->parseCurrentBlock();
1911 $tpl->setCurrentBlock(
"tbl_action_btn");
1912 $tpl->setVariable(
"BTN_NAME",
"listUsersRole");
1913 $tpl->setVariable(
"BTN_VALUE",$this->lng->txt(
"role_list_users"));
1914 $tpl->parseCurrentBlock();
1916 if (!empty($a_role_ids))
1919 $tpl->setCurrentBlock(
"tbl_action_toggle_checkboxes");
1920 $tpl->setVariable(
"JS_VARNAME",
"role");
1922 $tpl->setVariable(
"TXT_CHECKALL", $this->lng->txt(
"check_all"));
1923 $tpl->setVariable(
"TXT_UNCHECKALL", $this->lng->txt(
"uncheck_all"));
1924 $tpl->parseCurrentBlock();
1927 $tpl->setCurrentBlock(
"tbl_action_row");
1928 $tpl->setVariable(
"COLUMN_COUNTS",4);
1930 $tpl->parseCurrentBlock();
1932 $tbl->setTitle($this->lng->txt(
"role_header_edit_users"),
"icon_usr.gif",$this->lng->txt(
"role_header_edit_users"));
1933 $tbl->setHeaderNames(array(
"",
1934 $this->lng->txt(
"obj_role"),
1935 $this->lng->txt(
"role_count_users")));
1936 $tbl->setHeaderVars(array(
"",
1939 $this->ctrl->getParameterArray($this,
"search",
false));
1946 $tbl->setColumnWidth(array(
"",
"80%",
"19%"));
1952 $this->tpl->setVariable(
"SEARCH_RESULT_TABLE",$tbl->tpl->get());
1960 $tpl =& $tbl->getTemplateObject();
1962 $tpl->setCurrentBlock(
"tbl_form_header");
1963 $tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
1964 $tpl->parseCurrentBlock();
1966 $tpl->setCurrentBlock(
"tbl_action_btn");
1967 $tpl->setVariable(
"BTN_NAME",
"searchUserForm");
1968 $tpl->setVariable(
"BTN_VALUE",$this->lng->txt(
"back"));
1969 $tpl->parseCurrentBlock();
1971 $tpl->setCurrentBlock(
"tbl_action_btn");
1972 $tpl->setVariable(
"BTN_NAME",
"listUsersGroup");
1973 $tpl->setVariable(
"BTN_VALUE",$this->lng->txt(
"grp_list_users"));
1974 $tpl->parseCurrentBlock();
1976 if (!empty($a_grp_ids))
1979 $tpl->setCurrentBlock(
"tbl_action_toggle_checkboxes");
1980 $tpl->setVariable(
"JS_VARNAME",
"group");
1982 $tpl->setVariable(
"TXT_CHECKALL", $this->lng->txt(
"check_all"));
1983 $tpl->setVariable(
"TXT_UNCHECKALL", $this->lng->txt(
"uncheck_all"));
1984 $tpl->parseCurrentBlock();
1987 $tpl->setCurrentBlock(
"tbl_action_row");
1988 $tpl->setVariable(
"COLUMN_COUNTS",4);
1990 $tpl->parseCurrentBlock();
1992 $tbl->setTitle($this->lng->txt(
"grp_header_edit_members"),
"icon_usr.gif",$this->lng->txt(
"grp_header_edit_members"));
1993 $tbl->setHeaderNames(array(
"",
1994 $this->lng->txt(
"obj_grp"),
1995 $this->lng->txt(
"grp_count_members")));
1996 $tbl->setHeaderVars(array(
"",
1999 array(
"ref_id" => $this->rolf_ref_id,
2000 "obj_id" => $this->object->getId(),
2002 "cmdClass" =>
"ilobjrolegui",
2003 "cmdNode" =>
$_GET[
"cmdNode"]));
2005 $tbl->setColumnWidth(array(
"",
"80%",
"19%"));
2011 $this->tpl->setVariable(
"SEARCH_RESULT_TABLE",$tbl->tpl->get());
2018 global $rbacsystem,$rbacreview;
2020 $_SESSION[
"role_role"] = $_POST[
"role"] = $_POST[
"role"] ? $_POST[
"role"] :
$_SESSION[
"role_role"];
2022 if (!is_array($_POST[
"role"]))
2030 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.role_usr_selection.html");
2031 $this->
__showButton(
"searchUserForm",$this->lng->txt(
"role_new_search"));
2036 foreach ($_POST[
"role"] as $role_id)
2038 $members = array_merge($rbacreview->assignedUsers($role_id),$members);
2041 $members = array_unique($members);
2045 $f_result = array();
2047 foreach($members as
$user)
2054 $user_ids[$counter] =
$user;
2058 $f_result[$counter][] = $tmp_obj->getLogin();
2059 $f_result[$counter][] = $tmp_obj->getFirstname();
2060 $f_result[$counter][] = $tmp_obj->getLastname();
2073 global $rbacsystem,$rbacreview,
$tree;
2075 $_SESSION[
"role_group"] = $_POST[
"group"] = $_POST[
"group"] ? $_POST[
"group"] :
$_SESSION[
"role_group"];
2077 if (!is_array($_POST[
"group"]))
2085 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.role_usr_selection.html");
2086 $this->
__showButton(
"searchUserForm",$this->lng->txt(
"role_new_search"));
2091 foreach ($_POST[
"group"] as $group_id)
2093 if (!$tree->isInTree($group_id))
2102 $members = array_merge($tmp_obj->getGroupMemberIds(),$members);
2107 $members = array_unique($members);
2111 $f_result = array();
2113 foreach($members as
$user)
2120 $user_ids[$counter] =
$user;
2123 $f_result[$counter][] = $tmp_obj->getLogin();
2124 $f_result[$counter][] = $tmp_obj->getFirstname();
2125 $f_result[$counter][] = $tmp_obj->getLastname();
2141 foreach ($a_path_arr as
$data)
2148 $path .= $data[
'title'];
2151 if (strlen($path) > 50)
2153 return '...'.substr($path,-50);
2163 $this->tpl->addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
2164 $this->tpl->addBlockFile(
"STATUSLINE",
"statusline",
"tpl.statusline.html");
2184 include_once
'./classes/class.ilTabsGUI.php';
2186 $this->tpl->setTitle($this->lng->txt(
'role'));
2187 $this->tpl->setDescription($this->object->getTitle());
2190 #$tabs_gui =& new ilTabsGUI();
2191 $this->
getTabs($this->tabs_gui);
2194 #$this->tpl->setVariable("TABS", $tabs_gui->getHTML());
2199 global
$tree, $ilias_locator;
2203 $this->tpl->addBlockFile(
"LOCATOR",
"locator",
"tpl.locator.html");
2207 foreach ($tree->getPathFull($this->rolf_ref_id) as $key => $row)
2211 $this->tpl->touchBlock(
'locator_separator_prefix');
2214 $this->tpl->setCurrentBlock(
"locator_item");
2216 if ($row[
"type"] ==
'rolf')
2218 $this->tpl->setVariable(
"ITEM",$this->object->getTitle());
2219 $this->tpl->setVariable(
"LINK_ITEM",$this->ctrl->getLinkTarget($this));
2221 elseif ($row[
"child"] != $tree->getRootId())
2223 $this->tpl->setVariable(
"ITEM", $row[
"title"]);
2224 $this->tpl->setVariable(
"LINK_ITEM",
"repository.php?ref_id=".$row[
"child"]);
2228 $this->tpl->setVariable(
"ITEM", $this->lng->txt(
"repository"));
2229 $this->tpl->setVariable(
"LINK_ITEM",
"repository.php?ref_id=".$row[
"child"]);
2232 $this->tpl->parseCurrentBlock();
2235 $this->tpl->setVariable(
"TXT_LOCATOR",$this->lng->txt(
"locator"));
2236 $this->tpl->parseCurrentBlock();
2247 if (
$_GET[
"admin_mode"] ==
"settings"
2248 &&
$_GET[
"ref_id"] != SYSTEM_FOLDER_ID)
2250 $ilLocator->addItem($this->lng->txt(
"administration"),
2251 $this->ctrl->getLinkTargetByClass(
"iladministrationgui",
"frameset"),
2254 $ilLocator->addItem($this->lng->txt(
"obj_".ilObject::_lookupType(
2256 $this->ctrl->getLinkTargetByClass(
"ilobjrolefoldergui",
"view"));
2258 if (
$_GET[
"obj_id"] > 0)
2260 $ilLocator->addItem($this->object->getTitle(),
2261 $this->ctrl->getLinkTarget($this,
"view"));
2274 if (strtolower(
$_GET[
"baseClass"]) ==
"iladministrationgui")
2276 if (
$_GET[
"admin_mode"] ==
"settings"
2277 &&
$_GET[
"ref_id"] != SYSTEM_FOLDER_ID)
2280 $this->ctrl->getLinkTargetByClass(
"ilobjrolefoldergui",
"view"));
2285 if ($this->object->getRefId() != ROOT_FOLDER_ID &&
2286 $this->
object->getRefId() != SYSTEM_FOLDER_ID)
2288 $par_id = $tree->getParentId($this->object->getRefId());
2289 $tpl->setUpperIcon(
"repository.php?ref_id=".$par_id);
2298 global $rbacsystem,$rbacreview;
2300 $base_role_folder = $rbacreview->getFoldersAssignedToRole($this->object->getId(),
true);
2305 $activate_role_edit =
false;
2310 if (in_array($this->rolf_ref_id,$base_role_folder) ||
2311 (strtolower(
$_GET[
"baseClass"]) ==
"iladministrationgui" &&
2312 $_GET[
"admin_mode"] ==
"settings"))
2314 $activate_role_edit =
true;
2318 $tabs_gui->clearTargets();
2320 if ($this->back_target !=
"")
2322 $tabs_gui->setBackTarget(
2323 $this->back_target[
"text"],$this->back_target[
"link"]);
2326 #if ($rbacsystem->checkAccess('write',$this->rolf_ref_id) && $activate_role_edit)
2327 if($this->
checkAccess(
'write',
'edit_permission') && $activate_role_edit)
2329 $tabs_gui->addTarget(
"edit_properties",
2330 $this->ctrl->getLinkTarget($this,
"edit"), array(
"edit",
"update"), get_class($this));
2333 #if ($rbacsystem->checkAccess('write',$this->rolf_ref_id))
2336 $force_active = (
$_GET[
"cmd"] ==
"perm" ||
$_GET[
"cmd"] ==
"")
2339 $tabs_gui->addTarget(
"default_perm_settings",
2340 $this->ctrl->getLinkTarget($this,
"perm"), array(
"perm",
"adoptPermSave",
"permSave"),
2345 #if ($rbacsystem->checkAccess('write',$this->rolf_ref_id) && $activate_role_edit)
2346 if($this->
checkAccess(
'write',
'edit_permission') && $activate_role_edit)
2348 $tabs_gui->addTarget(
"user_assignment",
2349 $this->ctrl->getLinkTarget($this,
"userassignment"),
2350 array(
"deassignUser",
"userassignment",
"assignUser",
"searchUserForm",
"search"),
2354 #if ($rbacsystem->checkAccess('write',$this->rolf_ref_id) && $activate_role_edit)
2355 if($this->
checkAccess(
'write',
'edit_permission') && $activate_role_edit)
2357 $tabs_gui->addTarget(
"desktop_items",
2358 $this->ctrl->getLinkTarget($this,
"listDesktopItems"),
2359 array(
"listDesktopItems",
"deleteDesktopItems",
"selectDesktopItem",
"askDeleteDesktopItem"),
2369 if(count($obj_ids) > 1)
2371 $_SESSION[
'mail_roles'][] =
'#il_role_'.$this->object->getId();
2375 $_SESSION[
'mail_roles'][] = $rbacreview->getRoleMailboxAddress($this->object->getId());
2377 $script =
'ilias.php?baseClass=ilMailGUI&type=role';
2383 global $rbacsystem,$ilAccess;
2385 $a_perm_obj = $a_perm_obj ? $a_perm_obj : $a_perm_global;
2387 if($this->rolf_ref_id == ROLE_FOLDER_ID)
2389 return $rbacsystem->checkAccess($a_perm_global,$this->rolf_ref_id);
2393 return $ilAccess->checkAccess($a_perm_obj,
'',$this->obj_ref_id);