4 include_once
"./classes/class.ilObjectGUI.php";
5 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
50 function __construct($a_data,$a_id,$a_call_by_reference =
false,$a_prepare_output =
true)
54 $lng->loadLanguageModule(
'rbac');
57 define(
"USER_FOLDER_ID",7);
59 if(
$_GET[
'rolf_ref_id'] !=
'')
61 $this->rolf_ref_id =
$_GET[
'rolf_ref_id'];
65 $this->rolf_ref_id =
$_GET[
'ref_id'];
68 $this->obj_ref_id = $tree->getParentId($this->rolf_ref_id);
72 $this->
ilObjectGUI($a_data,$a_id,$a_call_by_reference,
false);
73 $this->ctrl->saveParameter($this, array(
"obj_id",
"rolf_ref_id"));
91 if($this->ctrl->getTargetScript() ==
'repository.php' ||
92 $this->ctrl->getTargetScript() ==
'role.php' ||
93 $this->ctrl->getTargetScript() ==
'fblm_edit.php' ||
94 strtolower(
$_GET[
"baseClass"]) ==
'ilchathandlergui' ||
95 strtolower(
$_GET[
"baseClass"]) ==
'ilchatpresentationgui' ||
96 strtolower(
$_GET[
"baseClass"]) ==
'illmeditorgui' ||
97 strtolower(
$_GET[
"baseClass"]) ==
'ilexercisehandlergui' ||
98 strtolower(
$_GET[
"baseClass"]) ==
'illinkresourcehandlergui' ||
99 strtolower(
$_GET[
"baseClass"]) ==
'ilsahseditgui' ||
100 strtolower(
$_GET[
"baseClass"]) ==
'ilobjsurveygui' ||
101 strtolower(
$_GET[
"baseClass"]) ==
'ilwikihandlergui' ||
102 strtolower(
$_GET[
"baseClass"]) ==
'ilmediapoolpresentation' ||
103 strtolower(
$_GET[
"baseClass"]) ==
'ilobjsurveyquestionpoolgui' ||
104 strtolower(
$_GET[
"baseClass"]) ==
'ilobjtestgui' ||
105 strtolower(
$_GET[
"baseClass"]) ==
'ilobjquestionpoolgui' ||
106 strtolower(
$_GET[
"baseClass"]) ==
'ilglossaryeditorgui' ||
107 $_GET[
"admin_mode"] ==
"repository")
113 if (
$_GET[
"ref_id"] != SYSTEM_FOLDER_ID)
125 $next_class = $this->ctrl->getNextClass($this);
126 $cmd = $this->ctrl->getCmd();
130 case 'ilrepositorysearchgui':
131 include_once(
'./Services/Search/classes/class.ilRepositorySearchGUI.php');
133 $rep_search->setCallback($this,
'addUserObject');
136 $this->tabs_gui->setTabActive(
'user_assignment');
137 $this->ctrl->setReturn($this,
'userassignment');
138 $ret =& $this->ctrl->forwardCommand($rep_search);
150 $cmd =
'userassignment';
167 $this->back_target = array(
"text" => $a_text,
173 return $this->back_target ? $this->back_target : array();
207 global $rbacsystem,$rbacreview,
$tree;
210 #if(!$rbacsystem->checkAccess('edit_permission', $this->rolf_ref_id))
219 $this->rolf_ref_id != ROLE_FOLDER_ID)
226 include_once
'./classes/class.ilRoleDesktopItem.php';
231 $this->
__showButton(
'selectDesktopItem',$this->lng->txt(
'role_desk_add'));
233 if(!count($items = $role_desk_item_obj->getAll()))
238 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.role_desktop_item_list.html");
239 $this->tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
241 $this->tpl->setVariable(
"TBL_TITLE_IMG_ALT",$this->lng->txt(
'obj_role'));
242 $this->tpl->setVariable(
"TBL_TITLE",$this->lng->txt(
'role_assigned_desk_items').
' ('.$this->
object->getTitle().
')');
243 $this->tpl->setVariable(
"HEADER_DESC",$this->lng->txt(
'description'));
244 $this->tpl->setVariable(
"BTN_DELETE",$this->lng->txt(
'delete'));
249 foreach($items as $role_item_id => $item)
253 if(strlen(
$desc = $tmp_obj->getDescription()))
255 $this->tpl->setCurrentBlock(
"description");
256 $this->tpl->setVariable(
"DESCRIPTION_DESK",
$desc);
257 $this->tpl->parseCurrentBlock();
259 $this->tpl->setCurrentBlock(
"desk_row");
260 $this->tpl->setVariable(
"DESK_TITLE",$tmp_obj->getTitle());
262 $this->tpl->setVariable(
"CHECK_DESK",ilUtil::formCheckBox(0,
'del_desk_item[]',$role_item_id));
263 $this->tpl->setVariable(
"TXT_PATH",$this->lng->txt(
'path').
':');
264 $this->tpl->setVariable(
"PATH",$this->
__formatPath($tree->getPathFull($item[
'item_id'])));
265 $this->tpl->parseCurrentBlock();
276 #if(!$rbacsystem->checkAccess('edit_permission', $this->rolf_ref_id))
279 $this->ilias->raiseError($this->lng->txt(
"permission_denied"),$this->ilias->error_obj->MESSAGE);
281 if(!$rbacsystem->checkAccess(
'push_desktop_items',
USER_FOLDER_ID))
283 $this->ilias->raiseError($this->lng->txt(
"permission_denied"),$this->ilias->error_obj->MESSAGE);
285 if(!count(
$_POST[
'del_desk_item']))
295 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.role_ask_delete_desktop_item.html");
296 $this->tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
298 $this->tpl->setVariable(
"TBL_TITLE_IMG_ALT",$this->lng->txt(
'obj_role'));
299 $this->tpl->setVariable(
"TBL_TITLE",$this->lng->txt(
'role_assigned_desk_items').
' ('.$this->
object->getTitle().
')');
300 $this->tpl->setVariable(
"HEADER_DESC",$this->lng->txt(
'description'));
301 $this->tpl->setVariable(
"BTN_DELETE",$this->lng->txt(
'delete'));
302 $this->tpl->setVariable(
"BTN_CANCEL",$this->lng->txt(
'cancel'));
304 include_once
'./classes/class.ilRoleDesktopItem.php';
310 foreach(
$_POST[
'del_desk_item'] as $role_item_id)
312 $item_data = $role_desk_item_obj->
getItem($role_item_id);
315 if(strlen(
$desc = $tmp_obj->getDescription()))
317 $this->tpl->setCurrentBlock(
"description");
318 $this->tpl->setVariable(
"DESCRIPTION_DESK",
$desc);
319 $this->tpl->parseCurrentBlock();
321 $this->tpl->setCurrentBlock(
"desk_row");
322 $this->tpl->setVariable(
"DESK_TITLE",$tmp_obj->getTitle());
324 $this->tpl->parseCurrentBlock();
336 #if (!$rbacsystem->checkAccess('edit_permission', $this->rolf_ref_id))
339 $this->ilias->raiseError($this->lng->txt(
"permission_denied"),$this->ilias->error_obj->MESSAGE);
342 if (!$rbacsystem->checkAccess(
'push_desktop_items',
USER_FOLDER_ID))
344 $this->ilias->raiseError($this->lng->txt(
"permission_denied"),$this->ilias->error_obj->MESSAGE);
347 if (!count(
$_SESSION[
'role_del_desk_items']))
356 include_once
'./classes/class.ilRoleDesktopItem.php';
360 foreach (
$_SESSION[
'role_del_desk_items'] as $role_item_id)
362 $role_desk_item_obj->
delete($role_item_id);
374 global $rbacsystem,
$tree;
376 include_once
'./classes/class.ilRoleDesktopItemSelector.php';
377 include_once
'./classes/class.ilRoleDesktopItem.php';
379 if(!$rbacsystem->checkAccess(
'push_desktop_items',
USER_FOLDER_ID))
381 #$this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
387 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.role_desktop_item_selector.html");
388 $this->
__showButton(
'listDesktopItems',$this->lng->txt(
'back'));
394 $exp->setExpand(
$_GET[
"role_desk_item_link_expand"] ?
$_GET[
"role_desk_item_link_expand"] : $tree->readRootId());
395 $exp->setExpandTarget($this->ctrl->getLinkTarget($this,
'selectDesktopItem'));
399 $output = $exp->getOutput();
400 $this->tpl->setVariable(
"EXPLORER",$output);
410 if (!$rbacsystem->checkAccess(
'push_desktop_items',
USER_FOLDER_ID))
412 $this->ilias->raiseError($this->lng->txt(
"permission_denied"),$this->ilias->error_obj->MESSAGE);
417 if (!isset(
$_GET[
'item_id']))
425 include_once
'./classes/class.ilRoleDesktopItem.php';
432 $this->ctrl->redirect($this,
'listDesktopItems');
443 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
446 if($this->creation_mode)
448 $this->ctrl->setParameter($this,
"new_type",
'role');
450 $this->form->setFormAction($this->ctrl->getFormAction($this));
454 case self::MODE_GLOBAL_CREATE:
455 $this->form->setTitle($this->lng->txt(
'role_new'));
456 $this->form->addCommandButton(
'save',$this->lng->txt(
'role_new'));
459 case self::MODE_GLOBAL_UPDATE:
460 $this->form->setTitle($this->lng->txt(
'role_edit'));
461 $this->form->addCommandButton(
'update', $this->lng->txt(
'save'));
464 case self::MODE_LOCAL_CREATE:
465 case self::MODE_LOCAL_UPDATE:
468 $this->form->addCommandButton(
'cancel', $this->lng->txt(
'cancel'));
473 $title->setDisabled(
true);
475 $title->setValidationRegexp(
'/^(?!il_).*$/');
476 $title->setValidationFailureMessage($this->lng->txt(
'msg_role_reserved_prefix'));
479 $title->setRequired(
true);
480 $this->form->addItem(
$title);
485 $desc->setDisabled(
true);
489 $this->form->addItem(
$desc);
491 if($this->rolf_ref_id == ROLE_FOLDER_ID)
495 #$reg->setInfo($this->lng->txt('rbac_new_acc_reg_info'));
496 $this->form->addItem($reg);
500 #$la->setInfo($this->lng->txt('rbac_local_admin_info'));
501 $this->form->addItem($la);
506 #$pro->setInfo($this->lng->txt('role_protext_permission_info'));
507 $this->form->addItem($pro);
509 include_once
'Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php';
515 $quo->setInfo($this->lng->txt(
'enter_in_mb_desc').
'<br />'.$this->lng->txt(
'disk_quota_on_role_desc'));
516 $this->form->addItem($quo);
529 $role->
setTitle($this->form->getInput(
'title'));
546 include_once
'Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php';
556 $data[
'pro'] = $rbacreview->isProtected($this->rolf_ref_id, $role->
getId());
558 $this->form->setValuesByArray(
$data);
573 if(!$rbacsystem->checkAccess(
'create_role',$this->rolf_ref_id))
575 $ilErr->raiseError($this->lng->txt(
'permission_denied'),
$ilErr->MESSAGE);
579 $this->tpl->setContent($this->form->getHTML());
592 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),$ilErr->MESSAGE);
596 $this->tpl->setContent($this->form->getHTML());
607 require_once
'Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php';
608 require_once
'classes/class.ilFormat.php';
610 #if (!$rbacsystem->checkAccess("write", $this->rolf_ref_id))
613 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_write"),$this->ilias->error_obj->MESSAGE);
621 if (substr($this->object->getTitle(
false),0,3) !=
"il_")
627 $allow_register = (
$_SESSION[
"error_post_vars"][
"Fobject"][
"allow_register"]) ?
"checked=\"checked\"" :
"";
628 $assign_users = (
$_SESSION[
"error_post_vars"][
"Fobject"][
"assign_users"]) ?
"checked=\"checked\"" :
"";
629 $protect_permissions = (
$_SESSION[
"error_post_vars"][
"Fobject"][
"protect_permissions"]) ?
"checked=\"checked\"" :
"";
632 $disk_quota =
$_SESSION[
"error_post_vars"][
"Fobject"][
"disk_quota"];
637 if (substr($this->object->getTitle(),0,3) !=
"il_")
643 $allow_register = ($this->
object->getAllowRegister()) ?
"checked=\"checked\"" :
"";
644 $assign_users = $this->
object->getAssignUsersStatus() ?
"checked=\"checked\"" :
"";
649 $protect_permissions = $rbacreview->isProtected($this->rolf_ref_id,$this->object->getId()) ?
"checked=\"checked\"" :
"";
653 $obj_str =
"&obj_id=".$this->obj_id;
655 $this->tpl->setVariable(
"TXT_TITLE",$this->lng->txt(
"title"));
656 $this->tpl->setVariable(
"TXT_DESC",$this->lng->txt(
"desc"));
659 $global_roles = $rbacreview->getGlobalRoles();
661 $this->tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
662 $this->tpl->setVariable(
"TXT_HEADER", $this->lng->txt($this->object->getType().
"_edit"));
663 $this->tpl->setVariable(
"TARGET", $this->
getTargetFrame(
"update"));
664 $this->tpl->setVariable(
"TXT_CANCEL", $this->lng->txt(
"cancel"));
665 $this->tpl->setVariable(
"TXT_SUBMIT", $this->lng->txt(
"save"));
666 $this->tpl->setVariable(
"CMD_SUBMIT",
"update");
667 $this->tpl->setVariable(
"TXT_REQUIRED_FLD", $this->lng->txt(
"required_field"));
669 if (substr($this->object->getTitle(),0,3) ==
"il_")
671 $this->tpl->setVariable(
"SHOW_TITLE",
ilObjRole::_getTranslation($this->object->getTitle()).
" (".$this->object->getTitle().
")");
673 $rolf = $rbacreview->getFoldersAssignedToRole($this->object->getId(),
true);
674 $parent_node = $this->tree->getParentNodeData($rolf[0]);
676 $this->tpl->setVariable(
"SHOW_DESC",$this->lng->txt(
"obj_".$parent_node[
'type']).
" (".$parent_node[
'obj_id'].
") <br/>".$parent_node[
'title']);
678 $this->tpl->setVariable(
"TXT_CANCEL", $this->lng->txt(
"cancel"));
679 $this->tpl->setVariable(
"TXT_SUBMIT", $this->lng->txt(
"back"));
680 $this->tpl->setVariable(
"CMD_SUBMIT",
"cancel");
683 if ($this->object->getId() != ANONYMOUS_ROLE_ID and
684 $this->
object->getId() != SYSTEM_ROLE_ID and
685 in_array($this->object->getId(),$global_roles))
687 $this->tpl->setCurrentBlock(
"allow_register");
688 $this->tpl->setVariable(
"TXT_ALLOW_REGISTER",$this->lng->txt(
"allow_register"));
689 $this->tpl->setVariable(
"ALLOW_REGISTER",$allow_register);
690 $this->tpl->parseCurrentBlock();
692 $this->tpl->setCurrentBlock(
"assign_users");
693 $this->tpl->setVariable(
"TXT_ASSIGN_USERS",$this->lng->txt(
'allow_assign_users'));
694 $this->tpl->setVariable(
"ASSIGN_USERS",$assign_users);
695 $this->tpl->parseCurrentBlock();
697 $this->tpl->setCurrentBlock(
"protect_permissions");
698 $this->tpl->setVariable(
"TXT_PROTECT_PERMISSIONS",$this->lng->txt(
'role_protect_permissions'));
699 $this->tpl->setVariable(
"PROTECT_PERMISSIONS",$protect_permissions);
700 $this->tpl->parseCurrentBlock();
702 require_once
'Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php';
705 $this->tpl->setCurrentBlock(
"disk_quota");
706 $this->tpl->setVariable(
"TXT_DISK_QUOTA",$this->lng->txt(
"disk_quota"));
707 $this->tpl->setVariable(
"TXT_DISK_QUOTA_DESC",$this->lng->txt(
"enter_in_mb_desc").
'<br>'.$this->lng->txt(
"disk_quota_on_role_desc"));
708 $this->tpl->setVariable(
"DISK_QUOTA",$disk_quota);
709 $this->tpl->parseCurrentBlock();
721 global $rbacadmin,$rbacreview;
726 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
728 $this->role->create();
730 $rbacadmin->setProtected(
732 $this->role->getId(),
733 $this->form->getInput(
'pro') ?
'y' :
'n'
736 $this->ctrl->returnToParent($this);
740 $this->form->setValuesByPost();
741 $this->tpl->setContent($this->form->getHTML());
753 foreach($rbacreview->getRolesOfRoleFolder($this->rolf_ref_id) as $role_id)
755 if($role_id == $a_role_id)
761 if(strcmp(
$title, trim($this->form->getInput(
'title'))) === 0)
763 $this->form->getItemByPostVar(
'title')->setAlert($this->lng->txt(
'rbac_role_exists_alert'));
779 if($this->form->checkInput() and !$this->
checkDuplicate($this->object->getId()))
781 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
783 $this->
object->update();
784 $rbacadmin->setProtected(
786 $this->object->getId(),
787 $this->form->getInput(
'pro') ?
'y' :
'n'
790 $this->ctrl->redirect($this,
'edit');
794 $this->form->setValuesByPost();
795 $this->tpl->setContent($this->form->getHTML());
811 $ilTabs->setTabActive(
'default_perm_settings');
813 $access = $this->
checkAccess(
'visible,write',
'edit_permission');
816 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_perm"),$this->ilias->error_obj->MESSAGE);
820 $perm_def = $this->
object->__getPermissionDefinitions();
822 $rbac_objects =& $perm_def[0];
823 $rbac_operations =& $perm_def[1];
825 foreach ($rbac_objects as
$key => $obj_data)
827 if ($objDefinition->isPlugin($obj_data[
"type"]))
830 "obj_".$obj_data[
"type"]);
834 $rbac_objects[
$key][
"name"] = $this->lng->txt(
"obj_".$obj_data[
"type"]);
836 $rbac_objects[
$key][
"ops"] = $rbac_operations[
$key];
840 if ($this->rolf_ref_id != ROLE_FOLDER_ID)
843 $parent_data = $this->tree->getParentNodeData($this->rolf_ref_id);
845 $subobj_data = $this->objDefinition->getSubObjectsRecursively($parent_data[
"type"]);
848 foreach ($rbac_objects as
$key => $obj_data)
850 if ($obj_data[
"type"] ==
"rolf")
852 unset($rbac_objects[
$key]);
856 if (!$subobj_data[$obj_data[
"type"]] and $parent_data[
"type"] != $obj_data[
"type"])
858 unset($rbac_objects[
$key]);
875 foreach ($rbac_objects as
$key => $obj_data)
877 $arr_selected = $rbacreview->getOperationsOfRole($this->object->getId(), $obj_data[
"type"],
$this->rolf_ref_id);
878 $arr_checked = array_intersect($arr_selected,array_keys($rbac_operations[$obj_data[
"obj_id"]]));
880 foreach ($rbac_operations[$obj_data[
"obj_id"]] as $operation)
883 if ($this->object->getId() == SYSTEM_ROLE_ID)
890 $checked = in_array($operation[
"ops_id"],$arr_checked);
895 $box = ilUtil::formCheckBox($checked,
"template_perm[".$obj_data[
"type"].
"][]",$operation[
"ops_id"],$disabled);
896 $output[
"perm"][$obj_data[
"obj_id"]][$operation[
"ops_id"]] = $box;
901 $output[
"col_anz"] = count($rbac_objects);
902 $output[
"txt_save"] = $this->lng->txt(
"save");
903 $output[
"check_recursive"] = ilUtil::formCheckBox(0,
"recursive",1);
904 $output[
"text_recursive"] = $this->lng->txt(
"change_existing_objects");
905 $output[
"text_recursive_desc"] = $this->lng->txt(
"change_existing_objects_desc");
907 $protected_disabled =
true;
909 if ($this->rolf_ref_id == ROLE_FOLDER_ID or $rbacreview->isAssignable($this->object->getId(),
$this->rolf_ref_id))
911 $protected_disabled =
false;
914 $output[
"check_protected"] = ilUtil::formCheckBox($rbacreview->isProtected($this->rolf_ref_id,$this->object->getId()),
917 $protected_disabled);
919 $output[
"text_protected"] = $this->lng->txt(
"role_protect_permissions");
920 $output[
"text_protected_desc"] = $this->lng->txt(
"role_protect_permissions_desc");
927 $output[
"message_middle"] = $this->lng->txt(
"adopt_perm_from_template");
930 if ($this->object->getId() == SYSTEM_ROLE_ID)
932 $output[
"adopt"] = array();
933 $output[
"sysrole_msg"] = $this->lng->txt(
"msg_sysrole_not_editable");
938 $parent_role_ids = $rbacreview->getParentRoleIds($this->rolf_ref_id,
true);
940 foreach($parent_role_ids as $id => $tmp)
952 foreach($sorted_ids as $id)
954 $par = $parent_role_ids[$id];
955 #foreach ($sorted_roles as $par)
957 if ($par[
"obj_id"] != SYSTEM_ROLE_ID)
960 $output[
"adopt"][
$key][
"css_row_adopt"] = (
$key % 2 == 0) ?
"tblrow1" :
"tblrow2";
961 $output[
"adopt"][
$key][
"check_adopt"] = $radio;
962 $output[
"adopt"][
$key][
"role_id"] = $par[
"obj_id"];
963 $output[
"adopt"][
$key][
"type"] = ($par[
"type"] ==
'role' ?
'Role' :
'Template');
964 $output[
"adopt"][
$key][
"role_name"] = $par[
"title"];
965 $output[
"adopt"][
$key][
"role_desc"] = $par[
"desc"];
970 $output[
"formaction_adopt"] = $this->ctrl->getFormAction($this);
974 $output[
"formaction"] = $this->ctrl->getFormAction($this);
976 $this->data = $output;
983 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.adm_perm_role.html');
986 if($access and $this->object->isDeletable($this->rolf_ref_id))
988 $this->tpl->setVariable(
'LINK_DELETE_ROLE',$this->ctrl->getLinkTarget($this,
'confirmDeleteRole'));
989 $this->tpl->setVariable(
'TXT_DELETE_ROLE',$this->lng->txt(
'rbac_delete_role'));
990 $this->tpl->setVariable(
'TXT_FOOTER_DELETE_ROLE',$this->lng->txt(
'rbac_delete_role'));
993 foreach ($rbac_objects as $obj_data)
996 $this->tpl->setCurrentBlock(
"object_operations");
1000 foreach ($obj_data[
"ops"] as $operation)
1002 $ops_ids[] = $operation[
"ops_id"];
1005 $css_row =
"tblrow1";
1006 $this->tpl->setVariable(
"CSS_ROW",$css_row);
1007 $this->tpl->setVariable(
"PERMISSION",$operation[
"name"]);
1008 if (substr($operation[
"title"], 0, 7) ==
"create_")
1010 if ($this->objDefinition->getDevMode(substr($operation[
"title"], 7, strlen($operation[
"title"]) -7)))
1012 $this->tpl->setVariable(
"TXT_NOT_IMPL",
"(".$this->lng->txt(
"not_implemented_yet").
")");
1015 $this->tpl->setVariable(
"CHECK_PERMISSION",$this->data[
"perm"][$obj_data[
"obj_id"]][$operation[
"ops_id"]]);
1016 $this->tpl->setVariable(
"LABEL_ID",
"template_perm_".$obj_data[
"type"].
"_".$operation[
"ops_id"]);
1017 $this->tpl->parseCurrentBlock();
1021 $this->tpl->setCurrentBlock(
"object_type");
1024 if ($objDefinition->isSystemObject($obj_data[
"type"]) &&
1025 $obj_data[
"type"] !=
"root")
1027 $this->tpl->setVariable(
"TXT_ADMINIS",
"(".$this->lng->txt(
"administration").
") ");
1030 $this->tpl->setVariable(
"TXT_OBJ_TYPE",$obj_data[
"name"]);
1033 if ($this->objDefinition->getDevMode($obj_data[
"type"]))
1035 $this->tpl->setVariable(
"TXT_NOT_IMPL",
"(".$this->lng->txt(
"not_implemented_yet").
")");
1037 else if ($obj_data[
"type"] ==
"icrs" and !$this->ilias->getSetting(
"ilinc_active"))
1039 $this->tpl->setVariable(
"TXT_NOT_IMPL",
"(".$this->lng->txt(
"not_enabled_or_configured").
")");
1043 $this->tpl->setVariable(
"OBJ_TYPE",$obj_data[
"type"]);
1044 $this->tpl->setVariable(
"CHANGE_PERM_OBJ_TYPE_DESC",$this->lng->txt(
"change_existing_object_type_desc"));
1047 if ($objDefinition->isPlugin($obj_data[
"type"]))
1049 $this->tpl->setVariable(
"CHANGE_PERM_OBJ_TYPE",$this->lng->txt(
"change_existing_prefix").
" ".
1051 " ".$this->lng->txt(
"change_existing_suffix"));
1053 else if ($objDefinition->isSystemObject($obj_data[
"type"]))
1055 $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"));
1060 $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"));
1064 $this->tpl->setVariable(
"JS_VARNAME",
"template_perm_".$obj_data[
"type"]);
1066 $this->tpl->setVariable(
"TXT_CHECKALL", $this->lng->txt(
"check_all"));
1067 $this->tpl->setVariable(
"TXT_UNCHECKALL", $this->lng->txt(
"uncheck_all"));
1069 $this->tpl->parseCurrentBlock();
1074 if ($this->object->getId() != SYSTEM_ROLE_ID)
1077 foreach ($this->data[
"adopt"] as
$key => $value)
1079 $this->tpl->setCurrentBlock(
"ADOPT_PERM_ROW");
1080 $this->tpl->setVariable(
"CSS_ROW_ADOPT",$value[
"css_row_adopt"]);
1081 $this->tpl->setVariable(
"CHECK_ADOPT",$value[
"check_adopt"]);
1082 $this->tpl->setVariable(
"LABEL_ID",$value[
"role_id"]);
1083 $this->tpl->setVariable(
"TYPE",$value[
"type"]);
1084 $this->tpl->setVariable(
"ROLE_NAME",$value[
"role_name"]);
1085 if(strlen($value[
'role_desc']))
1087 $this->tpl->setVariable(
'ROLE_DESC',$value[
'role_desc']);
1090 $this->tpl->parseCurrentBlock();
1093 $this->tpl->setCurrentBlock(
"ADOPT_PERM_FORM");
1094 $this->tpl->setVariable(
"MESSAGE_MIDDLE",$this->data[
"message_middle"]);
1095 $this->tpl->setVariable(
"FORMACTION_ADOPT",$this->data[
"formaction_adopt"]);
1096 $this->tpl->setVariable(
"ADOPT",$this->lng->txt(
'copy'));
1097 $this->tpl->parseCurrentBlock();
1100 $this->tpl->setCurrentBlock(
"tblfooter_special_options");
1101 $this->tpl->setVariable(
"TXT_PERM_SPECIAL_OPTIONS",$this->lng->txt(
"perm_special_options"));
1102 $this->tpl->parseCurrentBlock();
1104 $this->tpl->setCurrentBlock(
"tblfooter_recursive");
1105 $this->tpl->setVariable(
"COL_ANZ",3);
1106 $this->tpl->setVariable(
"CHECK_RECURSIVE",$this->data[
"check_recursive"]);
1107 $this->tpl->setVariable(
"TXT_RECURSIVE",$this->data[
"text_recursive"]);
1108 $this->tpl->setVariable(
"TXT_RECURSIVE_DESC",$this->data[
"text_recursive_desc"]);
1109 $this->tpl->parseCurrentBlock();
1111 $this->tpl->setCurrentBlock(
"tblfooter_protected");
1112 $this->tpl->setVariable(
"COL_ANZ",3);
1113 $this->tpl->setVariable(
"CHECK_PROTECTED",$this->data[
"check_protected"]);
1114 $this->tpl->setVariable(
"TXT_PROTECTED",$this->data[
"text_protected"]);
1115 $this->tpl->setVariable(
"TXT_PROTECTED_DESC",$this->data[
"text_protected_desc"]);
1116 $this->tpl->parseCurrentBlock();
1118 $this->tpl->setCurrentBlock(
"tblfooter_standard");
1119 $this->tpl->setVariable(
"COL_ANZ_PLUS",3);
1120 $this->tpl->setVariable(
"TXT_SAVE",$this->data[
"txt_save"]);
1121 $this->tpl->parseCurrentBlock();
1126 $this->tpl->setCurrentBlock(
"tblfooter_sysrole");
1127 $this->tpl->setVariable(
"COL_ANZ_SYS",3);
1128 $this->tpl->parseCurrentBlock();
1131 $this->tpl->setCurrentBlock(
"sysrole_msg");
1132 $this->tpl->setVariable(
"TXT_SYSROLE_MSG",$this->data[
"sysrole_msg"]);
1133 $this->tpl->parseCurrentBlock();
1136 $this->tpl->setCurrentBlock(
"adm_content");
1137 $this->tpl->setVariable(
"TBL_TITLE_IMG",
ilUtil::getImagePath(
"icon_".$this->object->getType().
".gif"));
1138 $this->tpl->setVariable(
"TBL_TITLE_IMG_ALT",$this->lng->txt($this->object->getType()));
1140 $this->tpl->setVariable(
"TBL_HELP_LINK",
"tbl_help.php");
1141 $this->tpl->setVariable(
"TBL_HELP_IMG_ALT",$this->lng->txt(
"help"));
1144 $global_roles = $rbacreview->getGlobalRoles();
1146 if (in_array($this->object->getId(),$global_roles))
1153 if($rolf = $rbacreview->getFoldersAssignedToRole($this->object->getId(),
true))
1155 $parent_node = $this->tree->getParentNodeData($rolf[0]);
1156 $desc = $this->lng->txt(
"obj_".$parent_node[
'type']).
" (#".$parent_node[
'obj_id'].
") : ".$parent_node[
'title'];
1160 $description =
" <span class=\"small\">(".$desc.
")</span>";
1163 if (substr($this->object->getTitle(),0,3) ==
"il_")
1169 $title = $this->
object->getTitle();
1172 $this->tpl->setVariable(
"TBL_TITLE",
$title.$description);
1175 $pid = $tree->getParentId($this->rolf_ref_id);
1177 if ($this->rolf_ref_id != ROLE_FOLDER_ID)
1179 $info = sprintf($this->lng->txt(
"perm_role_info_1"),
1180 $this->
object->getTitle(), $ptitle).
" ".
1181 sprintf($this->lng->txt(
"perm_role_info_2"),
1182 $this->
object->getTitle(), $ptitle);
1186 $info = sprintf($this->lng->txt(
"perm_role_info_glob_1"),
1187 $this->
object->getTitle(), $ptitle).
" ".
1188 sprintf($this->lng->txt(
"perm_role_info_glob_2"),
1189 $this->
object->getTitle(), $ptitle);
1191 $this->tpl->setVariable(
"TXT_TITLE_INFO", $info);
1193 $this->tpl->setVariable(
"TXT_PERMISSION",$this->data[
"txt_permission"]);
1194 $this->tpl->setVariable(
"FORMACTION",$this->data[
"formaction"]);
1195 $this->tpl->parseCurrentBlock();
1206 global
$ilErr,$rbacreview,$ilUser;
1208 $access = $this->
checkAccess(
'visible,write',
'edit_permission');
1211 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_perm'),$ilErr->WARNING);
1214 $question = $this->lng->txt(
'rbac_role_delete_qst');
1215 if($rbacreview->isAssigned($ilUser->getId(), $this->
object->getId()))
1217 $question .= (
'<br />'.$this->lng->txt(
'rbac_role_delete_self'));
1221 include_once
'./Services/Utilities/classes/class.ilConfirmationGUI.php';
1224 $confirm->setFormAction($this->ctrl->getFormAction($this));
1225 $confirm->setHeaderText($question);
1226 $confirm->setCancel($this->lng->txt(
'cancel'),
'perm');
1227 $confirm->setConfirm($this->lng->txt(
'rbac_delete_role'),
'performDeleteRole');
1231 $this->object->getId(),
1232 $this->
object->getTitle(),
1236 $this->tpl->setContent($confirm->getHTML());
1248 $access = $this->
checkAccess(
'visible,write',
'edit_permission');
1251 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_perm'),$ilErr->WARNING);
1254 $this->
object->setParent((
int)
$_GET[
'rolf_ref_id']);
1255 $this->
object->delete();
1264 $this->ctrl->returnToParent($this);
1288 $access = $this->
checkAccess(
'visible,write',
'edit_permission');
1292 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_perm"),$this->ilias->error_obj->MESSAGE);
1298 if (empty(
$_POST[
"template_perm"]))
1300 $_POST[
"template_perm"] = array();
1303 foreach (
$_POST[
"template_perm"] as
$key => $ops_array)
1310 $this->
object->update();
1313 if ($this->rolf_ref_id == ROLE_FOLDER_ID or $rbacreview->isAssignable($this->object->getId(),
$this->rolf_ref_id))
1315 $rbacadmin->setProtected($this->rolf_ref_id,$this->object->getId(),
ilUtil::tf2yn(
$_POST[
'protected']));
1319 if(!
$_POST[
'recursive'] and !is_array(
$_POST[
'recursive_list']))
1322 $this->ctrl->redirect($this,
"perm");
1332 $start = ($this->rolf_ref_id == ROLE_FOLDER_ID ? ROOT_FOLDER_ID : $tree->getParentId($this->rolf_ref_id));
1335 $this->
object->changeExistingObjects(
1343 $this->
object->changeExistingObjects(
1350 $this->ctrl->redirect($this,
'perm');
1356 if (
$_POST[
"recursive"] or is_array(
$_POST[
"recursive_list"]))
1359 if ($this->rolf_ref_id == ROLE_FOLDER_ID)
1361 $node_id = ROOT_FOLDER_ID;
1365 $node_id = $this->tree->getParentId($this->rolf_ref_id);
1369 $node_data = $this->tree->getNodeData($node_id);
1370 $subtree_nodes = $this->tree->getSubTree($node_data);
1373 $all_parent_obj_of_rolf = $rbacreview->getObjectsWithStopedInheritance($this->object->getId());
1376 if ($this->rolf_ref_id == ROLE_FOLDER_ID)
1378 $key = array_keys($all_parent_obj_of_rolf,SYSTEM_FOLDER_ID);
1382 $key = array_keys($all_parent_obj_of_rolf,$node_id);
1385 unset($all_parent_obj_of_rolf[
$key[0]]);
1389 foreach ($subtree_nodes as $node)
1393 if (in_array($node[
"child"],$all_parent_obj_of_rolf))
1395 $lft = $node[
"lft"];
1396 $rgt = $node[
"rgt"];
1401 $valid_nodes[] = $node;
1405 if (($node[
"lft"] > $lft) && ($node[
"rgt"] < $rgt))
1413 if (in_array($node[
"child"],$all_parent_obj_of_rolf))
1415 $lft = $node[
"lft"];
1416 $rgt = $node[
"rgt"];
1421 $valid_nodes[] = $node;
1427 foreach ($valid_nodes as $key => $node)
1430 if (is_array(
$_POST[
"recursive_list"]) and !in_array($node[
"type"],
$_POST[
"recursive_list"]))
1432 unset($valid_nodes[$key]);
1436 $node_ids[] = $node[
"child"];
1437 $valid_nodes[
$key][
"perms"] =
$_POST[
"template_perm"][$node[
"type"]];
1450 if (!empty($node_ids))
1453 $rbacadmin->revokePermissionList($node_ids,$this->object->getId());
1456 foreach ($valid_nodes as $node)
1458 if (is_array($node[
"perms"]))
1460 $rbacadmin->grantPermission($this->object->getId(),$node[
"perms"],$node[
"child"]);
1477 global $rbacadmin, $rbacsystem, $rbacreview,
$tree;
1486 $access = $this->
checkAccess(
'visible,write',
'edit_permission');
1489 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_perm"),$this->ilias->error_obj->MESSAGE);
1492 if ($this->object->getId() ==
$_POST[
"adopt"])
1499 $parentRoles = $rbacreview->getParentRoleIds($this->rolf_ref_id,
true);
1500 $rbacadmin->copyRoleTemplatePermissions(
1502 $parentRoles[
$_POST[
"adopt"]][
"parent"],
1504 $this->object->getId(),
1508 $this->
object->update();
1511 $obj_data =& $this->ilias->obj_factory->getInstanceByObjId($_POST[
"adopt"]);
1512 ilUtil::sendSuccess($this->lng->txt(
"msg_perm_adopted_from1").
" '".$obj_data->getTitle().
"'.<br/>".
1513 $this->lng->txt(
"msg_perm_adopted_from2"),
true);
1516 $this->ctrl->redirect($this,
"perm");
1538 global $rbacsystem, $rbacadmin, $rbacreview;
1540 #if (!$rbacsystem->checkAccess("edit_userassignment", $this->rolf_ref_id))
1541 if(!$this->
checkAccess(
'edit_userassignment',
'edit_permission'))
1543 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_assign_user_to_role"),$this->ilias->error_obj->MESSAGE);
1547 $this->rolf_ref_id != ROLE_FOLDER_ID)
1549 $this->ilias->raiseError($this->lng->txt(
"err_role_not_assignable"),$this->ilias->error_obj->MESSAGE);
1552 if(!isset(
$_POST[
"user"]))
1560 $selected_users =
$_POST[
"user"];
1561 $assigned_users_all = $rbacreview->assignedUsers($this->object->getId());
1564 $assigned_users_new = array_diff($selected_users,array_intersect($selected_users,$assigned_users_all));
1567 if (count($assigned_users_new) == 0)
1576 foreach ($assigned_users_new as
$user)
1578 $rbacadmin->assignUser($this->object->getId(),
$user,
false);
1582 $this->
object->update();
1586 $this->ctrl->redirect($this,
'userassignment');
1596 global $rbacreview,$rbacadmin;
1598 if(!$this->
checkAccess(
'edit_userassignment',
'edit_permission'))
1604 $this->rolf_ref_id != ROLE_FOLDER_ID)
1615 $assigned_users_all = $rbacreview->assignedUsers($this->object->getId());
1618 $assigned_users_new = array_diff($a_user_ids,array_intersect($a_user_ids,$assigned_users_all));
1621 if (count($assigned_users_new) == 0)
1628 foreach ($assigned_users_new as
$user)
1630 $rbacadmin->assignUser($this->object->getId(),
$user,
false);
1634 $this->
object->update();
1637 $this->ctrl->redirect($this,
'userassignment');
1647 global $rbacsystem, $rbacadmin, $rbacreview;
1649 #if (!$rbacsystem->checkAccess("edit_userassignment", $this->rolf_ref_id))
1650 if(!$this->
checkAccess(
'edit_userassignment',
'edit_permission'))
1652 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_assign_user_to_role"),$this->ilias->error_obj->MESSAGE);
1661 $selected_users = (
$_POST[
"user_id"]) ?
$_POST[
"user_id"] : array(
$_GET[
"user_id"]);
1663 if ($selected_users[0]=== NULL)
1665 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
1669 if ($this->object->getId() == SYSTEM_ROLE_ID)
1671 if ($admin = array_search(SYSTEM_USER_ID,$selected_users) !==
false)
1672 unset($selected_users[$admin]);
1676 $last_role = array();
1677 $global_roles = $rbacreview->getGlobalRoles();
1679 foreach ($selected_users as
$user)
1681 $assigned_roles = $rbacreview->assignedRoles($user);
1682 $assigned_global_roles = array_intersect($assigned_roles,$global_roles);
1684 if (count($assigned_roles) == 1 or (count($assigned_global_roles) == 1 and in_array($this->object->getId(),$assigned_global_roles)))
1686 $userObj = $this->ilias->obj_factory->getInstanceByObjId($user);
1687 $last_role[
$user] = $userObj->getFullName();
1693 if (count($last_role) > 0)
1695 $user_list = implode(
", ",$last_role);
1696 $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);
1700 foreach ($selected_users as $user)
1702 $rbacadmin->deassignUser($this->object->getId(),
$user);
1706 $this->
object->update();
1710 $this->ctrl->redirect($this,
'userassignment');
1720 global $rbacsystem, $rbacreview, $rbacadmin,
$tree;
1721 require_once
'Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php';
1722 require_once
'classes/class.ilFormat.php';
1735 $access = $this->
checkAccess(
'write',
'edit_permission');
1738 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_modify_role"),$this->ilias->error_obj->MESSAGE);
1741 if (substr($this->object->getTitle(),0,3) !=
"il_")
1744 if (empty(
$_POST[
"Fobject"][
"title"]))
1746 $this->ilias->raiseError($this->lng->txt(
"fill_out_all_required_fields"),$this->ilias->error_obj->MESSAGE);
1750 if (substr(
$_POST[
"Fobject"][
"title"],0,3) ==
"il_")
1752 $this->ilias->raiseError($this->lng->txt(
"msg_role_reserved_prefix"),$this->ilias->error_obj->MESSAGE);
1757 if (! is_numeric(trim(
$_POST[
"Fobject"][
"disk_quota"])) ||
1758 trim(
$_POST[
"Fobject"][
"disk_quota"]) < 0
1761 $this->ilias->raiseError($this->lng->txt(
"msg_disk_quota_illegal_value"),$this->ilias->error_obj->MESSAGE);
1779 if (
$_POST[
"Fobject"][
"allow_register"] ==
"")
1781 $roles_allowed = $this->
object->_lookupRegisterAllowed();
1783 if (count($roles_allowed) == 1 and $roles_allowed[0][
'id'] == $this->object->getId())
1785 $this->ilias->raiseError($this->lng->txt(
"msg_last_role_for_registration"),$this->ilias->error_obj->MESSAGE);
1789 $this->
object->setAllowRegister(
$_POST[
"Fobject"][
"allow_register"]);
1790 $this->
object->toggleAssignUsersStatus(
$_POST[
"Fobject"][
"assign_users"]);
1791 $rbacadmin->setProtected($this->rolf_ref_id,$this->object->getId(),
ilUtil::tf2yn(
$_POST[
"Fobject"][
"protect_permissions"]));
1792 $this->
object->update();
1796 $this->ctrl->redirect($this,
'edit');
1805 global $rbacreview, $rbacsystem;
1808 if(!$this->
checkAccess(
'edit_userassignment',
'edit_permission'))
1810 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_assign_user_to_role"),$this->ilias->error_obj->MESSAGE);
1813 $this->tabs_gui->setTabActive(
'user_assignment');
1815 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.rbac_ua.html',
'Services/AccessControl');
1817 include_once
'./Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
1819 $tb->setFormAction($this->ctrl->getFormAction($this));
1821 $this->lng->txt(
'role_add_user'),
1822 $this->ctrl->getLinkTargetByClass(
'ilRepositorySearchGUI',
'start')
1826 $this->lng->txt(
'role_mailto'),
1827 $this->ctrl->getLinkTarget($this,
'mailToRole')
1829 $this->tpl->setVariable(
'BUTTONS_UA',$tb->getHTML());
1831 include_once
'./Services/AccessControl/classes/class.ilAssignedUsersTableGUI.php';
1834 $this->tpl->setVariable(
'TABLE_UA',
$ut->getHTML());
1838 $assigned_users = $rbacreview->assignedUsers($this->object->getId(),array(
"login",
"firstname",
"lastname",
"usr_id"));
1841 $val_contact = $this->lng->txt(
"message");
1842 $val_change = $this->lng->txt(
"edit");
1843 $val_leave = $this->lng->txt(
"remove");
1844 $val_contact_desc = $this->lng->txt(
"role_user_send_mail");
1845 $val_change_desc = $this->lng->txt(
"role_user_edit");
1846 $val_leave_desc = $this->lng->txt(
"role_user_deassign");
1849 foreach ($assigned_users as
$user)
1851 $link_contact =
"ilias.php?baseClass=ilMailGUI&type=new&rcp_to=".urlencode($user[
"login"]);
1853 if (
$_GET[
"admin_mode"] ==
"settings"
1854 &&
$_GET[
"ref_id"] != SYSTEM_FOLDER_ID)
1856 $this->ctrl->setParameterByClass(
"ilobjusergui",
"ref_id", 7);
1857 $this->ctrl->setParameterByClass(
"ilobjusergui",
"obj_id", $user[
"usr_id"]);
1858 $link_change = $this->ctrl->getLinkTargetByClass(array(
"iladministrationgui",
"ilobjusergui"),
"view");
1859 $this->ctrl->setParameterByClass(
"ilobjusergui",
"ref_id",
$_GET[
"ref_id"]);
1862 $this->ctrl->setParameter($this,
"user_id", $user[
"usr_id"]);
1863 $link_leave = $this->ctrl->getLinkTarget($this,
"deassignUser");
1865 $member_functions =
"";
1868 if ($this->object->getId() != ANONYMOUS_ROLE_ID or $user[
"usr_id"] != ANONYMOUS_USER_ID)
1871 $member_functions =
"<a class=\"il_ContainerItemCommand\" href=\"".$link_contact.
"\" title=\"".$val_contact_desc.
"\">".$val_contact.
"</a>";
1873 if (strtolower(
$_GET[
"baseClass"]) ==
'iladministrationgui' &&
$_GET[
"admin_mode"] ==
"settings")
1875 $member_functions .=
" <a class=\"il_ContainerItemCommand\" href=\"".$link_change.
"\" title=\"".$val_change_desc.
"\">".$val_change.
"</a>";
1878 if ($this->object->getId() != SYSTEM_ROLE_ID or $user[
"usr_id"] != SYSTEM_USER_ID)
1880 $member_functions .=
" <a class=\"il_ContainerItemCommand\" href=\"".$link_leave.
"\" title=\"".$val_leave_desc.
"\">".$val_leave.
"</a>";
1885 if (($this->object->getId() == SYSTEM_ROLE_ID and $user[
"usr_id"] == SYSTEM_USER_ID)
1886 or ($this->object->getId() == ANONYMOUS_ROLE_ID and $user[
"usr_id"] == ANONYMOUS_USER_ID))
1888 $result_set[$counter][] =
"";
1892 $result_set[$counter][] = ilUtil::formCheckBox(0,
"user_id[]",$user[
"usr_id"]);
1895 $user_ids[$counter] = $user[
"usr_id"];
1897 $result_set[$counter][] = $user[
"login"];
1898 $result_set[$counter][] = $user[
"firstname"];
1899 $result_set[$counter][] = $user[
"lastname"];
1900 $result_set[$counter][] = $member_functions;
1904 unset($member_functions);
1914 $actions = array(
"deassignUser" => $this->lng->txt(
"remove"));
1917 $tpl =& $tbl->getTemplateObject();
1919 $this->tpl->addBlockfile(
"BUTTONS",
"buttons",
"tpl.buttons.html");
1922 $this->tpl->setCurrentBlock(
"btn_cell");
1923 $this->tpl->setVariable(
"BTN_LINK",$this->ctrl->getLinkTargetByClass(
'ilRepositorySearchGUI',
'start'));
1924 $this->tpl->setVariable(
"BTN_TXT",$this->lng->txt(
'role_add_user'));
1925 $this->tpl->parseCurrentBlock();
1927 $this->
__showButton(
'mailToRole',$this->lng->txt(
'role_mailto'),
'_blank');
1929 $tpl->setCurrentBlock(
"tbl_form_header");
1930 $tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
1931 $tpl->parseCurrentBlock();
1933 $tpl->setCurrentBlock(
"tbl_action_row");
1935 $tpl->setVariable(
"COLUMN_COUNTS",5);
1940 $tpl->setCurrentBlock(
"tbl_action_btn");
1942 $tpl->setVariable(
"BTN_VALUE",$value);
1943 $tpl->parseCurrentBlock();
1946 if (!empty($a_user_ids))
1949 $tpl->setCurrentBlock(
"tbl_action_toggle_checkboxes");
1950 $tpl->setVariable(
"JS_VARNAME",
"user_id");
1952 $tpl->setVariable(
"TXT_CHECKALL", $this->lng->txt(
"check_all"));
1953 $tpl->setVariable(
"TXT_UNCHECKALL", $this->lng->txt(
"uncheck_all"));
1954 $tpl->parseCurrentBlock();
1957 $tpl->setVariable(
"TPLPATH",$this->tpl->tplPath);
1958 $this->ctrl->setParameter($this,
"cmd",
"userassignment");
1961 $tbl->setTitle($this->lng->txt(
"assigned_users"),
"icon_usr.gif",$this->lng->txt(
"users"));
1964 $tbl->setHeaderNames(array(
"",$this->lng->txt(
"username"),$this->lng->txt(
"firstname"),
1965 $this->lng->txt(
"lastname"),$this->lng->txt(
"grp_options")));
1966 $tbl->setHeaderVars(array(
"",
"login",
"firstname",
"lastname",
"functions"),
1967 $this->ctrl->getParameterArray($this,
"",
false));
1968 $tbl->setColumnWidth(array(
"",
"20%",
"25%",
"25%",
"30%"));
1972 $this->tpl->setVariable(
"ADM_CONTENT",$tbl->tpl->get());
1979 include_once
"./Services/Table/classes/class.ilTableGUI.php";
1989 $order =
$_GET[
"sort_by"] ?
$_GET[
"sort_by"] :
"title";
1993 $order =
$_GET[
"sort_by"] ?
$_GET[
"sort_by"] :
"title";
1998 if (
$_GET[
"sort_by"] ==
"title" or empty(
$_GET[
"sort_by"]))
2000 $_GET[
"sort_by"] =
"login";
2002 $order =
$_GET[
"sort_by"];
2006 $tbl->setOrderColumn($order);
2007 $tbl->setOrderDirection(
$_GET[
"sort_order"]);
2008 $tbl->setOffset(
$_GET[
"offset"]);
2009 $tbl->setLimit(
$_GET[
"limit"]);
2010 $tbl->setFooter(
"tblfooter",$this->lng->txt(
"previous"),$this->lng->txt(
"next"));
2011 $tbl->setData($result_set);
2019 if(!$this->
checkAccess(
'edit_userassignment',
'edit_permission'))
2021 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_assign_user_to_role"),$this->ilias->error_obj->MESSAGE);
2024 $this->lng->loadLanguageModule(
'search');
2026 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.role_users_search.html");
2028 $this->tpl->setVariable(
"F_ACTION",$this->ctrl->getFormAction($this));
2029 $this->tpl->setVariable(
"SEARCH_ASSIGN_USR",$this->lng->txt(
"role_search_users"));
2030 $this->tpl->setVariable(
"SEARCH_SEARCH_TERM",$this->lng->txt(
"search_search_term"));
2031 $this->tpl->setVariable(
"SEARCH_VALUE",
$_SESSION[
"role_search_str"] ?
$_SESSION[
"role_search_str"] :
"");
2032 $this->tpl->setVariable(
"SEARCH_FOR",$this->lng->txt(
"exc_search_for"));
2033 $this->tpl->setVariable(
"SEARCH_ROW_TXT_USER",$this->lng->txt(
"exc_users"));
2034 $this->tpl->setVariable(
"SEARCH_ROW_TXT_ROLE",$this->lng->txt(
"exc_roles"));
2035 $this->tpl->setVariable(
"SEARCH_ROW_TXT_GROUP",$this->lng->txt(
"exc_groups"));
2036 $this->tpl->setVariable(
"BTN2_VALUE",$this->lng->txt(
"cancel"));
2037 $this->tpl->setVariable(
"BTN1_VALUE",$this->lng->txt(
"search"));
2039 $usr = (
$_POST[
"search_for"] ==
"usr" ||
$_POST[
"search_for"] ==
"") ? 1 : 0;
2040 $grp = (
$_POST[
"search_for"] ==
"grp") ? 1 : 0;
2041 $role = (
$_POST[
"search_for"] ==
"role") ? 1 : 0;
2052 unset(
$_SESSION[
"role_delete_member_ids"]);
2053 unset(
$_SESSION[
"role_delete_subscriber_ids"]);
2067 if (
$_GET[
"new_type"] !=
"role")
2069 $this->ctrl->redirect($this,
"userassignment");
2073 $this->ctrl->redirectByClass(
"ilobjrolefoldergui",
"view");
2079 global $rbacsystem,
$tree;
2081 #if (!$rbacsystem->checkAccess("edit_userassignment", $this->rolf_ref_id))
2082 if(!$this->
checkAccess(
'edit_userassignment',
'edit_permission'))
2084 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_assign_user_to_role"),$this->ilias->error_obj->MESSAGE);
2090 if (!isset(
$_POST[
"search_for"]) or !isset(
$_POST[
"search_str"]))
2106 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.role_usr_selection.html");
2107 $this->
__showButton(
"searchUserForm",$this->lng->txt(
"role_new_search"));
2110 $f_result = array();
2112 switch(
$_POST[
"search_for"])
2122 $user_ids[$counter] = $user[
"id"];
2125 $f_result[$counter][] = $tmp_obj->getLogin();
2126 $f_result[$counter][] = $tmp_obj->getFirstname();
2127 $f_result[$counter][] = $tmp_obj->getLastname();
2140 if ($role[
"id"] == ANONYMOUS_ROLE_ID)
2151 if ($tmp_obj->getCountMembers() == 0)
2156 $role_ids[$counter] = $role[
"id"];
2159 $f_result[$counter][] = array($tmp_obj->getTitle(),$tmp_obj->getDescription());
2160 $f_result[$counter][] = $tmp_obj->getCountMembers();
2173 if(!$tree->isInTree($group[
"id"]))
2184 if ($tmp_obj->getId() == $this->
object->getId())
2189 $grp_ids[$counter] = $group[
"id"];
2192 $f_result[$counter][] = array($tmp_obj->getTitle(),$tmp_obj->getDescription());
2193 $f_result[$counter][] = $tmp_obj->getCountMembers();
2206 include_once(
"./classes/class.ilSearch.php");
2208 $this->lng->loadLanguageModule(
"content");
2210 $search->setPerformUpdate(
false);
2212 $search->setCombination(
"and");
2213 $search->setSearchFor(array(0 => $a_search_for));
2214 $search->setSearchType(
'new');
2216 if ($search->validate($message))
2218 $search->performSearch();
2223 $this->ctrl->redirect($this,
"searchUserForm");
2226 return $search->getResultByType($a_search_for);
2231 $return_to =
"searchUserForm";
2233 if ($a_cmd ==
"listUsersRole" or $a_cmd ==
"listUsersGroup")
2235 $return_to =
"search";
2239 $tpl =& $tbl->getTemplateObject();
2242 $tpl->setCurrentBlock(
"tbl_form_header");
2243 $tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
2244 $tpl->parseCurrentBlock();
2246 $tpl->setCurrentBlock(
"tbl_action_btn");
2247 $tpl->setVariable(
"BTN_NAME",$return_to);
2248 $tpl->setVariable(
"BTN_VALUE",$this->lng->txt(
"back"));
2249 $tpl->parseCurrentBlock();
2251 $tpl->setCurrentBlock(
"tbl_action_btn");
2252 $tpl->setVariable(
"BTN_NAME",
"assignUser");
2253 $tpl->setVariable(
"BTN_VALUE",$this->lng->txt(
"add"));
2254 $tpl->parseCurrentBlock();
2256 if (!empty($a_user_ids))
2259 $tpl->setCurrentBlock(
"tbl_action_toggle_checkboxes");
2260 $tpl->setVariable(
"JS_VARNAME",
"user");
2262 $tpl->setVariable(
"TXT_CHECKALL", $this->lng->txt(
"check_all"));
2263 $tpl->setVariable(
"TXT_UNCHECKALL", $this->lng->txt(
"uncheck_all"));
2264 $tpl->parseCurrentBlock();
2267 $tpl->setCurrentBlock(
"tbl_action_row");
2268 $tpl->setVariable(
"COLUMN_COUNTS",4);
2270 $tpl->parseCurrentBlock();
2272 $tbl->setTitle($this->lng->txt(
"role_header_edit_users"),
"icon_usr.gif",$this->lng->txt(
"role_header_edit_users"));
2273 $tbl->setHeaderNames(array(
"",
2274 $this->lng->txt(
"username"),
2275 $this->lng->txt(
"firstname"),
2276 $this->lng->txt(
"lastname")));
2277 $tbl->setHeaderVars(array(
"",
2281 $this->ctrl->getParameterArray($this,$a_cmd,
false));
2288 $tbl->setColumnWidth(array(
"",
"33%",
"33%",
"33%"));
2293 $this->tpl->setVariable(
"SEARCH_RESULT_TABLE",$tbl->tpl->get());
2301 $tpl =& $tbl->getTemplateObject();
2303 $tpl->setCurrentBlock(
"tbl_form_header");
2304 $tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
2305 $tpl->parseCurrentBlock();
2307 $tpl->setCurrentBlock(
"tbl_action_btn");
2308 $tpl->setVariable(
"BTN_NAME",
"searchUserForm");
2309 $tpl->setVariable(
"BTN_VALUE",$this->lng->txt(
"back"));
2310 $tpl->parseCurrentBlock();
2312 $tpl->setCurrentBlock(
"tbl_action_btn");
2313 $tpl->setVariable(
"BTN_NAME",
"listUsersRole");
2314 $tpl->setVariable(
"BTN_VALUE",$this->lng->txt(
"role_list_users"));
2315 $tpl->parseCurrentBlock();
2317 if (!empty($a_role_ids))
2320 $tpl->setCurrentBlock(
"tbl_action_toggle_checkboxes");
2321 $tpl->setVariable(
"JS_VARNAME",
"role");
2323 $tpl->setVariable(
"TXT_CHECKALL", $this->lng->txt(
"check_all"));
2324 $tpl->setVariable(
"TXT_UNCHECKALL", $this->lng->txt(
"uncheck_all"));
2325 $tpl->parseCurrentBlock();
2328 $tpl->setCurrentBlock(
"tbl_action_row");
2329 $tpl->setVariable(
"COLUMN_COUNTS",4);
2331 $tpl->parseCurrentBlock();
2333 $tbl->setTitle($this->lng->txt(
"role_header_edit_users"),
"icon_usr.gif",$this->lng->txt(
"role_header_edit_users"));
2334 $tbl->setHeaderNames(array(
"",
2335 $this->lng->txt(
"obj_role"),
2336 $this->lng->txt(
"role_count_users")));
2337 $tbl->setHeaderVars(array(
"",
2340 $this->ctrl->getParameterArray($this,
"search",
false));
2347 $tbl->setColumnWidth(array(
"",
"80%",
"19%"));
2353 $this->tpl->setVariable(
"SEARCH_RESULT_TABLE",$tbl->tpl->get());
2361 $tpl =& $tbl->getTemplateObject();
2363 $tpl->setCurrentBlock(
"tbl_form_header");
2364 $tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
2365 $tpl->parseCurrentBlock();
2367 $tpl->setCurrentBlock(
"tbl_action_btn");
2368 $tpl->setVariable(
"BTN_NAME",
"searchUserForm");
2369 $tpl->setVariable(
"BTN_VALUE",$this->lng->txt(
"back"));
2370 $tpl->parseCurrentBlock();
2372 $tpl->setCurrentBlock(
"tbl_action_btn");
2373 $tpl->setVariable(
"BTN_NAME",
"listUsersGroup");
2374 $tpl->setVariable(
"BTN_VALUE",$this->lng->txt(
"grp_list_users"));
2375 $tpl->parseCurrentBlock();
2377 if (!empty($a_grp_ids))
2380 $tpl->setCurrentBlock(
"tbl_action_toggle_checkboxes");
2381 $tpl->setVariable(
"JS_VARNAME",
"group");
2383 $tpl->setVariable(
"TXT_CHECKALL", $this->lng->txt(
"check_all"));
2384 $tpl->setVariable(
"TXT_UNCHECKALL", $this->lng->txt(
"uncheck_all"));
2385 $tpl->parseCurrentBlock();
2388 $tpl->setCurrentBlock(
"tbl_action_row");
2389 $tpl->setVariable(
"COLUMN_COUNTS",4);
2391 $tpl->parseCurrentBlock();
2393 $tbl->setTitle($this->lng->txt(
"grp_header_edit_members"),
"icon_usr.gif",$this->lng->txt(
"grp_header_edit_members"));
2394 $tbl->setHeaderNames(array(
"",
2395 $this->lng->txt(
"obj_grp"),
2396 $this->lng->txt(
"grp_count_members")));
2397 $tbl->setHeaderVars(array(
"",
2400 array(
"ref_id" => $this->rolf_ref_id,
2401 "obj_id" => $this->object->getId(),
2403 "cmdClass" =>
"ilobjrolegui",
2404 "cmdNode" =>
$_GET[
"cmdNode"]));
2406 $tbl->setColumnWidth(array(
"",
"80%",
"19%"));
2412 $this->tpl->setVariable(
"SEARCH_RESULT_TABLE",$tbl->tpl->get());
2419 global $rbacsystem,$rbacreview;
2423 if (!is_array(
$_POST[
"role"]))
2431 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.role_usr_selection.html");
2432 $this->
__showButton(
"searchUserForm",$this->lng->txt(
"role_new_search"));
2437 foreach (
$_POST[
"role"] as $role_id)
2439 $members = array_merge($rbacreview->assignedUsers($role_id),$members);
2442 $members = array_unique($members);
2446 $f_result = array();
2448 foreach($members as
$user)
2455 $user_ids[$counter] =
$user;
2459 $f_result[$counter][] = $tmp_obj->getLogin();
2460 $f_result[$counter][] = $tmp_obj->getFirstname();
2461 $f_result[$counter][] = $tmp_obj->getLastname();
2474 global $rbacsystem,$rbacreview,
$tree;
2478 if (!is_array(
$_POST[
"group"]))
2486 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.role_usr_selection.html");
2487 $this->
__showButton(
"searchUserForm",$this->lng->txt(
"role_new_search"));
2492 foreach (
$_POST[
"group"] as $group_id)
2494 if (!$tree->isInTree($group_id))
2503 $members = array_merge($tmp_obj->getGroupMemberIds(),$members);
2508 $members = array_unique($members);
2512 $f_result = array();
2514 foreach($members as
$user)
2521 $user_ids[$counter] =
$user;
2524 $f_result[$counter][] = $tmp_obj->getLogin();
2525 $f_result[$counter][] = $tmp_obj->getFirstname();
2526 $f_result[$counter][] = $tmp_obj->getLastname();
2542 foreach ($a_path_arr as
$data)
2549 $path .= $data[
'title'];
2552 if (strlen($path) > 50)
2554 return '...'.substr($path,-50);
2564 $this->tpl->addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
2565 $this->tpl->addBlockFile(
"STATUSLINE",
"statusline",
"tpl.statusline.html");
2585 include_once
'./classes/class.ilTabsGUI.php';
2587 $this->tpl->setTitle($this->lng->txt(
'role'));
2588 $this->tpl->setDescription($this->object->getTitle());
2591 #$tabs_gui =& new ilTabsGUI();
2592 $this->
getTabs($this->tabs_gui);
2595 #$this->tpl->setVariable("TABS", $tabs_gui->getHTML());
2600 global
$tree, $ilias_locator;
2604 $this->tpl->addBlockFile(
"LOCATOR",
"locator",
"tpl.locator.html",
"Services/Locator");
2608 foreach ($tree->getPathFull($this->rolf_ref_id) as
$key =>
$row)
2612 $this->tpl->touchBlock(
'locator_separator_prefix');
2615 $this->tpl->setCurrentBlock(
"locator_item");
2617 if (
$row[
"type"] ==
'rolf')
2619 $this->tpl->setVariable(
"ITEM",$this->object->getTitle());
2620 $this->tpl->setVariable(
"LINK_ITEM",$this->ctrl->getLinkTarget($this));
2624 $this->tpl->setVariable(
"ITEM",
$row[
"title"]);
2625 $this->tpl->setVariable(
"LINK_ITEM",
"repository.php?ref_id=".
$row[
"child"]);
2629 $this->tpl->setVariable(
"ITEM", $this->lng->txt(
"repository"));
2630 $this->tpl->setVariable(
"LINK_ITEM",
"repository.php?ref_id=".
$row[
"child"]);
2633 $this->tpl->parseCurrentBlock();
2636 $this->tpl->setVariable(
"TXT_LOCATOR",$this->lng->txt(
"locator"));
2637 $this->tpl->parseCurrentBlock();
2648 if (
$_GET[
"admin_mode"] ==
"settings"
2649 &&
$_GET[
"ref_id"] == ROLE_FOLDER_ID)
2651 $ilLocator->addItem($this->lng->txt(
"administration"),
2652 $this->ctrl->getLinkTargetByClass(
"iladministrationgui",
"frameset"),
2655 $ilLocator->addItem($this->lng->txt(
"obj_".ilObject::_lookupType(
2657 $this->ctrl->getLinkTargetByClass(
"ilobjrolefoldergui",
"view"));
2659 if (
$_GET[
"obj_id"] > 0)
2661 $ilLocator->addItem($this->object->getTitle(),
2662 $this->ctrl->getLinkTarget($this,
"view"));
2677 if (strtolower(
$_GET[
"baseClass"]) ==
"iladministrationgui")
2679 if (
$_GET[
"admin_mode"] ==
"settings"
2680 &&
$_GET[
"ref_id"] != SYSTEM_FOLDER_ID)
2683 $this->ctrl->getLinkTargetByClass(
"ilobjrolefoldergui",
"view"));
2688 if ($this->object->getRefId() != ROOT_FOLDER_ID &&
2689 $this->
object->getRefId() != SYSTEM_FOLDER_ID)
2691 $par_id = $tree->getParentId($this->object->getRefId());
2692 $tpl->setUpperIcon(
"repository.php?ref_id=".$par_id);
2701 global $rbacsystem,$rbacreview;
2703 $base_role_folder = $rbacreview->getFoldersAssignedToRole($this->object->getId(),
true);
2708 $activate_role_edit =
false;
2713 if (in_array($this->rolf_ref_id,$base_role_folder) ||
2714 (strtolower(
$_GET[
"baseClass"]) ==
"iladministrationgui" &&
2715 $_GET[
"admin_mode"] ==
"settings"))
2717 $activate_role_edit =
true;
2721 $tabs_gui->clearTargets();
2723 if ($this->back_target !=
"")
2725 $tabs_gui->setBackTarget(
2726 $this->back_target[
"text"],$this->back_target[
"link"]);
2729 if($this->
checkAccess(
'write',
'edit_permission') && $activate_role_edit)
2731 $tabs_gui->addTarget(
"edit_properties",
2732 $this->ctrl->getLinkTarget($this,
"edit"), array(
"edit",
"update"), get_class($this));
2737 $force_active = (
$_GET[
"cmd"] ==
"perm" ||
$_GET[
"cmd"] ==
"")
2740 $tabs_gui->addTarget(
"default_perm_settings",
2741 $this->ctrl->getLinkTarget($this,
"perm"), array(
"perm",
"adoptPermSave",
"permSave"),
2746 if($this->
checkAccess(
'write',
'edit_permission') && $activate_role_edit)
2748 $tabs_gui->addTarget(
"user_assignment",
2749 $this->ctrl->getLinkTarget($this,
"userassignment"),
2750 array(
"deassignUser",
"userassignment",
"assignUser",
"searchUserForm",
"search"),
2754 if($this->
checkAccess(
'write',
'edit_permission') && $activate_role_edit)
2756 $tabs_gui->addTarget(
"desktop_items",
2757 $this->ctrl->getLinkTarget($this,
"listDesktopItems"),
2758 array(
"listDesktopItems",
"deleteDesktopItems",
"selectDesktopItem",
"askDeleteDesktopItem"),
2768 if(count($obj_ids) > 1)
2770 $_SESSION[
'mail_roles'][] =
'#il_role_'.$this->object->getId();
2774 $_SESSION[
'mail_roles'][] = $rbacreview->getRoleMailboxAddress($this->object->getId());
2776 $script =
'ilias.php?baseClass=ilMailGUI&type=role';
2782 global $rbacsystem,$ilAccess;
2784 $a_perm_obj = $a_perm_obj ? $a_perm_obj : $a_perm_global;
2786 if($this->rolf_ref_id == ROLE_FOLDER_ID)
2788 return $rbacsystem->checkAccess($a_perm_global,$this->rolf_ref_id);
2792 return $ilAccess->checkAccess($a_perm_obj,
'',$this->obj_ref_id);
2804 if(!(
int)
$_POST[
'recursive'] and !is_array(
$_POST[
'recursive_list']))
2810 if($rbacreview->isProtected($this->rolf_ref_id, $this->object->getId()))
2814 return count($rbacreview->getFoldersAssignedToRole($this->object->getId())) > 1;
2820 return count($rbacreview->getFoldersAssignedToRole($this->object->getId())) > 1;
2830 $protected =
$_POST[
'protected'];
2832 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
2834 $form->setFormAction($this->ctrl->getFormAction($this,
'changeExistingObjects'));
2835 $form->setTitle($this->lng->txt(
'rbac_change_existing_confirm_tbl'));
2837 $form->addCommandButton(
'changeExistingObjects', $this->lng->txt(
'change_existing_objects'));
2838 $form->addCommandButton(
'perm',$this->lng->txt(
'cancel'));
2843 serialize(array(
'all')) :
2844 serialize(
$_POST[
'recursive_list'])
2846 $form->addItem($hidden);
2854 $this->lng->txt(
'rbac_keep_local_policies'),
2856 $this->lng->txt(
'rbac_keep_local_policies_info')
2863 $this->lng->txt(
'rbac_keep_local_policies'),
2865 $this->lng->txt(
'rbac_unprotected_keep_local_policies_info')
2869 $rad->addOption($keep);
2874 $this->lng->txt(
'rbac_delete_local_policies'),
2876 $this->lng->txt(
'rbac_delete_local_policies_info')
2882 $this->lng->txt(
'rbac_delete_local_policies'),
2884 $this->lng->txt(
'rbac_unprotected_delete_local_policies_info')
2887 $rad->addOption($del);
2889 $form->addItem($rad);
2890 $this->tpl->setContent($form->getHTML());
2899 global
$tree,$rbacreview,$rbacadmin;
2901 $mode = (int)
$_POST[
'mode'];
2902 $start = ($this->rolf_ref_id == ROLE_FOLDER_ID ? ROOT_FOLDER_ID : $tree->getParentId($this->rolf_ref_id));
2906 $this->ctrl->redirect($this,
'perm');