4 include_once
"./Services/Object/classes/class.ilObjectGUI.php";
5 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
52 function __construct($a_data,$a_id,$a_call_by_reference =
false,$a_prepare_output =
true)
56 $lng->loadLanguageModule(
'rbac');
59 define(
"USER_FOLDER_ID",7);
61 if(
$_GET[
'rolf_ref_id'] !=
'')
63 $this->rolf_ref_id =
$_GET[
'rolf_ref_id'];
67 $this->rolf_ref_id =
$_GET[
'ref_id'];
70 $this->obj_ref_id = $tree->getParentId($this->rolf_ref_id);
77 $this->
ilObjectGUI($a_data,$a_id,$a_call_by_reference,
false);
78 $this->ctrl->saveParameter($this, array(
"obj_id",
"rolf_ref_id"));
88 $next_class = $this->ctrl->getNextClass($this);
89 $cmd = $this->ctrl->getCmd();
93 case 'ilrepositorysearchgui':
94 include_once(
'./Services/Search/classes/class.ilRepositorySearchGUI.php');
96 $rep_search->setTitle($this->lng->txt(
'role_add_user'));
97 $rep_search->setCallback($this,
'addUserObject');
100 $this->tabs_gui->setTabActive(
'user_assignment');
101 $this->ctrl->setReturn($this,
'userassignment');
102 $ret =& $this->ctrl->forwardCommand($rep_search);
107 $this->tabs_gui->setTabActive(
'export');
109 include_once
'./Services/Export/classes/class.ilExportOptions.php';
113 include_once
'./Services/Export/classes/class.ilExportGUI.php';
115 $exp->addFormat(
'xml');
116 $this->ctrl->forwardCommand($exp);
128 $cmd =
'userassignment';
172 $this->back_target = array(
"text" => $a_text,
178 return $this->back_target ? $this->back_target : array();
212 global $rbacsystem,$rbacreview,
$tree;
215 #if(!$rbacsystem->checkAccess('edit_permission', $this->rolf_ref_id))
224 $this->rolf_ref_id != ROLE_FOLDER_ID)
231 include_once
'Services/AccessControl/classes/class.ilRoleDesktopItem.php';
236 $this->
__showButton(
'selectDesktopItem',$this->lng->txt(
'role_desk_add'));
238 if(!count($items = $role_desk_item_obj->getAll()))
243 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.role_desktop_item_list.html",
"Services/AccessControl");
244 $this->tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
246 $this->tpl->setVariable(
"TBL_TITLE_IMG_ALT",$this->lng->txt(
'obj_role'));
247 $this->tpl->setVariable(
"TBL_TITLE",$this->lng->txt(
'role_assigned_desk_items').
' ('.$this->
object->getTitle().
')');
248 $this->tpl->setVariable(
"HEADER_DESC",$this->lng->txt(
'description'));
249 $this->tpl->setVariable(
"BTN_DELETE",$this->lng->txt(
'delete'));
254 foreach($items as $role_item_id => $item)
258 if(strlen($desc = $tmp_obj->getDescription()))
260 $this->tpl->setCurrentBlock(
"description");
261 $this->tpl->setVariable(
"DESCRIPTION_DESK",$desc);
262 $this->tpl->parseCurrentBlock();
264 $this->tpl->setCurrentBlock(
"desk_row");
265 $this->tpl->setVariable(
"DESK_TITLE",$tmp_obj->getTitle());
267 $this->tpl->setVariable(
"CHECK_DESK",ilUtil::formCheckBox(0,
'del_desk_item[]',$role_item_id));
268 $this->tpl->setVariable(
"TXT_PATH",$this->lng->txt(
'path').
':');
269 $this->tpl->setVariable(
"PATH",$this->
__formatPath($tree->getPathFull($item[
'item_id'])));
270 $this->tpl->parseCurrentBlock();
281 #if(!$rbacsystem->checkAccess('edit_permission', $this->rolf_ref_id))
284 $this->ilias->raiseError($this->lng->txt(
"permission_denied"),$this->ilias->error_obj->MESSAGE);
286 if(!$rbacsystem->checkAccess(
'push_desktop_items',
USER_FOLDER_ID))
288 $this->ilias->raiseError($this->lng->txt(
"permission_denied"),$this->ilias->error_obj->MESSAGE);
290 if(!count(
$_POST[
'del_desk_item']))
300 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.role_ask_delete_desktop_item.html",
"Services/AccessControl");
301 $this->tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
303 $this->tpl->setVariable(
"TBL_TITLE_IMG_ALT",$this->lng->txt(
'obj_role'));
304 $this->tpl->setVariable(
"TBL_TITLE",$this->lng->txt(
'role_assigned_desk_items').
' ('.$this->
object->getTitle().
')');
305 $this->tpl->setVariable(
"HEADER_DESC",$this->lng->txt(
'description'));
306 $this->tpl->setVariable(
"BTN_DELETE",$this->lng->txt(
'delete'));
307 $this->tpl->setVariable(
"BTN_CANCEL",$this->lng->txt(
'cancel'));
309 include_once
'Services/AccessControl/classes/class.ilRoleDesktopItem.php';
315 foreach(
$_POST[
'del_desk_item'] as $role_item_id)
317 $item_data = $role_desk_item_obj->
getItem($role_item_id);
320 if(strlen($desc = $tmp_obj->getDescription()))
322 $this->tpl->setCurrentBlock(
"description");
323 $this->tpl->setVariable(
"DESCRIPTION_DESK",$desc);
324 $this->tpl->parseCurrentBlock();
326 $this->tpl->setCurrentBlock(
"desk_row");
327 $this->tpl->setVariable(
"DESK_TITLE",$tmp_obj->getTitle());
329 $this->tpl->parseCurrentBlock();
341 #if (!$rbacsystem->checkAccess('edit_permission', $this->rolf_ref_id))
344 $this->ilias->raiseError($this->lng->txt(
"permission_denied"),$this->ilias->error_obj->MESSAGE);
347 if (!$rbacsystem->checkAccess(
'push_desktop_items',
USER_FOLDER_ID))
349 $this->ilias->raiseError($this->lng->txt(
"permission_denied"),$this->ilias->error_obj->MESSAGE);
352 if (!count(
$_SESSION[
'role_del_desk_items']))
361 include_once
'Services/AccessControl/classes/class.ilRoleDesktopItem.php';
365 foreach (
$_SESSION[
'role_del_desk_items'] as $role_item_id)
367 $role_desk_item_obj->
delete($role_item_id);
379 global $rbacsystem,
$tree;
381 include_once
'Services/AccessControl/classes/class.ilRoleDesktopItemSelector.php';
382 include_once
'Services/AccessControl/classes/class.ilRoleDesktopItem.php';
384 if(!$rbacsystem->checkAccess(
'push_desktop_items',
USER_FOLDER_ID))
386 #$this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
392 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.role_desktop_item_selector.html",
"Services/AccessControl");
393 $this->
__showButton(
'listDesktopItems',$this->lng->txt(
'back'));
399 $exp->setExpand(
$_GET[
"role_desk_item_link_expand"] ?
$_GET[
"role_desk_item_link_expand"] : $tree->readRootId());
400 $exp->setExpandTarget($this->ctrl->getLinkTarget($this,
'selectDesktopItem'));
404 $output = $exp->getOutput();
405 $this->tpl->setVariable(
"EXPLORER",$output);
415 if (!$rbacsystem->checkAccess(
'push_desktop_items',
USER_FOLDER_ID))
417 $this->ilias->raiseError($this->lng->txt(
"permission_denied"),$this->ilias->error_obj->MESSAGE);
422 if (!isset(
$_GET[
'item_id']))
430 include_once
'Services/AccessControl/classes/class.ilRoleDesktopItem.php';
437 $this->ctrl->redirect($this,
'listDesktopItems');
448 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
451 if($this->creation_mode)
453 $this->ctrl->setParameter($this,
"new_type",
'role');
455 $this->form->setFormAction($this->ctrl->getFormAction($this));
459 case self::MODE_GLOBAL_CREATE:
460 $this->form->setTitle($this->lng->txt(
'role_new'));
461 $this->form->addCommandButton(
'save',$this->lng->txt(
'role_new'));
464 case self::MODE_GLOBAL_UPDATE:
465 $this->form->setTitle($this->lng->txt(
'role_edit'));
466 $this->form->addCommandButton(
'update', $this->lng->txt(
'save'));
469 case self::MODE_LOCAL_CREATE:
470 case self::MODE_LOCAL_UPDATE:
473 $this->form->addCommandButton(
'cancel', $this->lng->txt(
'cancel'));
480 $title->setValidationRegexp(
'/^(?!il_).*$/');
481 $title->setValidationFailureMessage($this->lng->txt(
'msg_role_reserved_prefix'));
483 $title->setMaxLength(70);
484 $title->setRequired(
true);
485 $this->form->addItem($title);
494 $this->form->addItem($desc);
496 if($this->rolf_ref_id == ROLE_FOLDER_ID)
500 #$reg->setInfo($this->lng->txt('rbac_new_acc_reg_info'));
501 $this->form->addItem($reg);
505 #$la->setInfo($this->lng->txt('rbac_local_admin_info'));
506 $this->form->addItem($la);
511 #$pro->setInfo($this->lng->txt('role_protext_permission_info'));
512 $this->form->addItem($pro);
514 include_once
'Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php';
520 $quo->setInfo($this->lng->txt(
'enter_in_mb_desc').
'<br />'.$this->lng->txt(
'disk_quota_on_role_desc'));
521 $this->form->addItem($quo);
525 $this->lng->loadLanguageModule(
"file");
526 $wquo =
new ilNumberInputGUI($this->lng->txt(
'personal_workspace_disk_quota'),
'wsp_disk_quota');
529 $wquo->setInfo($this->lng->txt(
'enter_in_mb_desc').
'<br />'.$this->lng->txt(
'disk_quota_on_role_desc'));
530 $this->form->addItem($wquo);
543 $role->
setTitle($this->form->getInput(
'title'));
561 include_once
'Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php';
575 $data[
'pro'] = $rbacreview->isProtected($this->rolf_ref_id, $role->
getId());
577 $this->form->setValuesByArray(
$data);
592 if(!$rbacsystem->checkAccess(
'create_role',$this->rolf_ref_id))
594 $ilErr->raiseError($this->lng->txt(
'permission_denied'),
$ilErr->MESSAGE);
598 $this->tpl->setContent($this->form->getHTML());
611 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),$ilErr->MESSAGE);
615 $this->tpl->setContent($this->form->getHTML());
625 global $rbacadmin,$rbacreview;
630 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
632 $this->role->create();
634 $rbacadmin->setProtected(
636 $this->role->getId(),
637 $this->form->getInput(
'pro') ?
'y' :
'n'
640 $this->ctrl->setParameter($this,
'obj_id',$this->role->getId());
641 $this->ctrl->redirect($this,
'perm');
645 $this->form->setValuesByPost();
646 $this->tpl->setContent($this->form->getHTML());
669 if($this->form->checkInput() and !$this->
checkDuplicate($this->object->getId()))
671 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
673 $this->
object->update();
674 $rbacadmin->setProtected(
676 $this->object->getId(),
677 $this->form->getInput(
'pro') ?
'y' :
'n'
680 $this->ctrl->redirect($this,
'edit');
684 $this->form->setValuesByPost();
685 $this->tpl->setContent($this->form->getHTML());
693 protected function permObject($a_show_admin_permissions =
false)
697 $ilTabs->setTabActive(
'default_perm_settings');
701 if($a_show_admin_permissions)
703 $ilTabs->setSubTabActive(
'rbac_admin_permissions');
707 $ilTabs->setSubTabActive(
'rbac_repository_permissions');
712 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_perm'),$ilErr->MESSAGE);
717 if($this->object->getId() != SYSTEM_ROLE_ID)
719 $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
720 $ilToolbar->addButton(
721 $this->lng->txt(
"adopt_perm_from_template"),
722 $this->ctrl->getLinkTarget($this,
'adoptPerm')
726 $ilToolbar->addButton(
727 $this->lng->txt(
'rbac_delete_role'),
728 $this->ctrl->getLinkTarget($this,
'confirmDeleteRole')
733 $this->tpl->addBlockFile(
736 'tpl.rbac_template_permissions.html',
737 'Services/AccessControl'
740 $this->tpl->setVariable(
'PERM_ACTION',$this->ctrl->getFormAction($this));
742 include_once
'./Services/Accordion/classes/class.ilAccordionGUI.php';
747 if($this->rolf_ref_id == ROLE_FOLDER_ID)
749 if($a_show_admin_permissions)
751 $subs = $objDefinition->getSubObjectsRecursively(
'adm',
true,
true);
755 $subs = $objDefinition->getSubObjectsRecursively(
'root',
true,$a_show_admin_permissions);
760 $subs = $objDefinition->getSubObjectsRecursively($this->
getParentType(),
true,$a_show_admin_permissions);
764 foreach($subs as $subtype => $def)
766 if($objDefinition->isPlugin($subtype))
770 elseif($objDefinition->isSystemObject($subtype))
772 $translation = $this->lng->txt(
"obj_".$subtype);
776 $translation = $this->lng->txt(
'objs_'.$subtype);
779 $sorted[$subtype] = $def;
780 $sorted[$subtype][
'translation'] = $translation;
785 foreach($sorted as $subtype => $def)
787 if($objDefinition->isPlugin($subtype))
791 elseif($objDefinition->isSystemObject($subtype))
793 $translation = $this->lng->txt(
"obj_".$subtype);
797 $translation = $this->lng->txt(
'objs_'.$subtype);
800 include_once
'Services/AccessControl/classes/class.ilObjectRoleTemplatePermissionTableGUI.php';
805 $this->object->getId(),
807 $a_show_admin_permissions
811 $acc->addItem($translation, $tbl->getHTML());
814 $this->tpl->setVariable(
'ACCORDION',$acc->getHTML());
817 include_once
'./Services/AccessControl/classes/class.ilObjectRoleTemplateOptionsTableGUI.php';
822 $this->object->getId(),
823 $a_show_admin_permissions
825 if($this->object->getId() != SYSTEM_ROLE_ID)
828 $a_show_admin_permissions ?
'adminPermSave' :
'permSave',
829 $this->lng->txt(
'save')
834 $this->tpl->setVariable(
'OPTIONS_TABLE',
$options->getHTML());
861 $parent_role_ids = $rbacreview->getParentRoleIds($this->rolf_ref_id,
true);
863 foreach($parent_role_ids as $id => $tmp)
871 foreach($sorted_ids as $id)
873 $par = $parent_role_ids[$id];
874 if ($par[
"obj_id"] != SYSTEM_ROLE_ID && $this->object->getId() != $par[
"obj_id"])
877 $output[
"adopt"][$key][
"css_row_adopt"] = ($key % 2 == 0) ?
"tblrow1" :
"tblrow2";
878 $output[
"adopt"][$key][
"check_adopt"] = $radio;
879 $output[
"adopt"][$key][
"role_id"] = $par[
"obj_id"];
880 $output[
"adopt"][$key][
"type"] = ($par[
"type"] ==
'role' ? $this->lng->txt(
'obj_role') : $this->lng->txt(
'obj_rolt'));
882 $output[
"adopt"][$key][
"role_desc"] = $par[
"desc"];
887 $output[
"formaction_adopt"] = $this->ctrl->getFormAction($this);
888 $output[
"message_middle"] = $this->lng->txt(
"adopt_perm_from_template");
891 $tpl =
new ilTemplate(
"tpl.adm_copy_role.html",
true,
true,
"Services/AccessControl");
893 $tpl->setCurrentBlock(
"ADOPT_PERM_ROW");
894 foreach ($output[
"adopt"] as $key => $value)
896 $tpl->setVariable(
"CSS_ROW_ADOPT",$value[
"css_row_adopt"]);
897 $tpl->setVariable(
"CHECK_ADOPT",$value[
"check_adopt"]);
898 $tpl->setVariable(
"LABEL_ID",$value[
"role_id"]);
899 $tpl->setVariable(
"TYPE",$value[
"type"]);
900 $tpl->setVariable(
"ROLE_NAME",$value[
"role_name"]);
901 if(strlen($value[
'role_desc']))
903 $tpl->setVariable(
'ROLE_DESC',$value[
'role_desc']);
905 $tpl->parseCurrentBlock();
908 $tpl->setVariable(
"TPLPATH",$this->tpl->tplPath);
909 $tpl->setVariable(
"MESSAGE_MIDDLE",$output[
"message_middle"]);
910 $tpl->setVariable(
"FORMACTION_ADOPT",$output[
"formaction_adopt"]);
911 $tpl->setVariable(
"ADOPT",$this->lng->txt(
'copy'));
912 $tpl->setVariable(
"CANCEL",$this->lng->txt(
'cancel'));
914 $tpl->setVariable(
'HEAD_ROLE',$this->lng->txt(
'title'));
915 $tpl->setVariable(
'HEAD_TYPE',$this->lng->txt(
'type'));
917 $this->tpl->setContent(
$tpl->get());
928 $access = $this->
checkAccess(
'visible,write',
'edit_permission');
931 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_perm'),$ilErr->WARNING);
934 $question = $this->lng->txt(
'rbac_role_delete_qst');
935 if($rbacreview->isAssigned($ilUser->getId(), $this->
object->getId()))
937 $question .= (
'<br />'.$this->lng->txt(
'rbac_role_delete_self'));
941 include_once
'./Services/Utilities/classes/class.ilConfirmationGUI.php';
944 $confirm->setFormAction($this->ctrl->getFormAction($this));
945 $confirm->setHeaderText($question);
946 $confirm->setCancel($this->lng->txt(
'cancel'),
'perm');
947 $confirm->setConfirm($this->lng->txt(
'rbac_delete_role'),
'performDeleteRole');
951 $this->object->getId(),
952 $this->
object->getTitle(),
956 $this->tpl->setContent($confirm->getHTML());
969 $access = $this->
checkAccess(
'visible,write',
'edit_permission');
972 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_perm'),$ilErr->WARNING);
975 $this->
object->setParent((
int)
$_GET[
'rolf_ref_id']);
976 $this->
object->delete();
979 $this->ctrl->returnToParent($this);
1002 $access = $this->
checkAccess(
'visible,write',
'edit_permission');
1006 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_perm"),$this->ilias->error_obj->MESSAGE);
1010 include_once
"Services/AccessControl/classes/class.ilRbacLog.php";
1012 if($rbac_log_active)
1018 if($this->rolf_ref_id == ROLE_FOLDER_ID)
1020 if($a_show_admin_permissions)
1022 $subs = $objDefinition->getSubObjectsRecursively(
'adm',
true,
true);
1026 $subs = $objDefinition->getSubObjectsRecursively(
'root',
true,
false);
1031 $subs = $objDefinition->getSubObjectsRecursively($this->
getParentType(),
true,
false);
1034 foreach($subs as $subtype => $def)
1037 $rbacadmin->deleteRolePermission($this->object->getId(),
$this->rolf_ref_id,$subtype);
1040 if (empty(
$_POST[
"template_perm"]))
1042 $_POST[
"template_perm"] = array();
1045 foreach (
$_POST[
"template_perm"] as $key => $ops_array)
1048 $rbacadmin->setRolePermission($this->object->getId(), $key, $ops_array,
$this->rolf_ref_id);
1051 if($rbac_log_active)
1059 $this->
object->update();
1062 if ($this->rolf_ref_id == ROLE_FOLDER_ID or $rbacreview->isAssignable($this->object->getId(),
$this->rolf_ref_id))
1064 $rbacadmin->setProtected($this->rolf_ref_id,$this->object->getId(),
ilUtil::tf2yn(
$_POST[
'protected']));
1067 if($a_show_admin_permissions)
1069 $_POST[
'recursive'] =
true;
1073 if(!
$_POST[
'recursive'] and !is_array(
$_POST[
'recursive_list']))
1076 if($a_show_admin_permissions)
1078 $this->ctrl->redirect($this,
'adminPerm');
1082 $this->ctrl->redirect($this,
'perm');
1092 $start = ($this->rolf_ref_id == ROLE_FOLDER_ID ? ROOT_FOLDER_ID : $tree->getParentId($this->rolf_ref_id));
1093 if($a_show_admin_permissions)
1095 $start = $tree->getParentId($this->rolf_ref_id);
1100 $this->
object->changeExistingObjects(
1105 #$a_show_admin_permissions ? array(
'adm') : array()
1110 $this->
object->changeExistingObjects(
1115 #$a_show_admin_permissions ? array(
'adm') : array()
1120 if($a_show_admin_permissions)
1122 $this->ctrl->redirect($this,
'adminPerm');
1126 $this->ctrl->redirect($this,
'perm');
1139 global $rbacadmin, $rbacsystem, $rbacreview,
$tree;
1148 $access = $this->
checkAccess(
'visible,write',
'edit_permission');
1151 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_perm"),$this->ilias->error_obj->MESSAGE);
1154 if ($this->object->getId() ==
$_POST[
"adopt"])
1161 $parentRoles = $rbacreview->getParentRoleIds($this->rolf_ref_id,
true);
1162 $rbacadmin->copyRoleTemplatePermissions(
1164 $parentRoles[
$_POST[
"adopt"]][
"parent"],
1166 $this->object->getId(),
1170 $this->
object->update();
1173 $obj_data =& $this->ilias->obj_factory->getInstanceByObjId($_POST[
"adopt"]);
1174 ilUtil::sendSuccess($this->lng->txt(
"msg_perm_adopted_from1").
" '".$obj_data->getTitle().
"'.<br/>".
1175 $this->lng->txt(
"msg_perm_adopted_from2"),
true);
1178 $this->ctrl->redirect($this,
"perm");
1188 $this->assignUserObject();
1200 global $rbacreview,$rbacadmin;
1202 if(!$this->
checkAccess(
'edit_userassignment',
'edit_permission'))
1208 $this->rolf_ref_id != ROLE_FOLDER_ID)
1215 $GLOBALS[
'lng']->loadLanguageModule(
'search');
1220 $assigned_users_all = $rbacreview->assignedUsers($this->object->getId());
1223 $assigned_users_new = array_diff($a_user_ids,array_intersect($a_user_ids,$assigned_users_all));
1226 if (count($assigned_users_new) == 0)
1229 $this->ctrl->redirect($this,
'userassignment');
1233 foreach ($assigned_users_new as $user)
1235 $rbacadmin->assignUser($this->object->getId(),$user,
false);
1239 $this->
object->update();
1242 $this->ctrl->redirect($this,
'userassignment');
1252 global $rbacsystem, $rbacadmin, $rbacreview;
1254 #if (!$rbacsystem->checkAccess("edit_userassignment", $this->rolf_ref_id))
1255 if(!$this->
checkAccess(
'edit_userassignment',
'edit_permission'))
1257 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_assign_user_to_role"),$this->ilias->error_obj->MESSAGE);
1260 $selected_users = (
$_POST[
"user_id"]) ?
$_POST[
"user_id"] : array(
$_GET[
"user_id"]);
1262 if ($selected_users[0]=== NULL)
1264 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
1268 if ($this->object->getId() == SYSTEM_ROLE_ID)
1270 if ($admin = array_search(SYSTEM_USER_ID,$selected_users) !==
false)
1271 unset($selected_users[$admin]);
1275 $last_role = array();
1276 $global_roles = $rbacreview->getGlobalRoles();
1278 foreach ($selected_users as $user)
1280 $assigned_roles = $rbacreview->assignedRoles($user);
1281 $assigned_global_roles = array_intersect($assigned_roles,$global_roles);
1283 if (count($assigned_roles) == 1 or (count($assigned_global_roles) == 1 and in_array($this->object->getId(),$assigned_global_roles)))
1285 $userObj = $this->ilias->obj_factory->getInstanceByObjId($user);
1286 $last_role[$user] = $userObj->getFullName();
1293 foreach ($selected_users as $user)
1295 if(!isset($last_role[$user]))
1297 $rbacadmin->deassignUser($this->object->getId(), $user);
1302 $this->
object->update();
1305 if(count($last_role))
1307 $user_list = implode(
", ",$last_role);
1308 ilUtil::sendFailure($this->lng->txt(
'msg_is_last_role').
': '.$user_list.
'<br />'.$this->lng->txt(
'msg_min_one_role'),
true);
1314 $this->ctrl->redirect($this,
'userassignment');
1326 if(!$this->
checkAccess(
'edit_userassignment',
'edit_permission'))
1328 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_assign_user_to_role"),$this->ilias->error_obj->MESSAGE);
1331 $this->tabs_gui->setTabActive(
'user_assignment');
1333 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.rbac_ua.html',
'Services/AccessControl');
1335 include_once
'./Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
1339 include_once
'./Services/PrivacySecurity/classes/class.ilSecuritySettings.php';
1341 $this->object->getId() != SYSTEM_ROLE_ID ||
1343 !$rbacreview->isAssigned($ilUser->getId(),SYSTEM_ROLE_ID) or
1351 include_once
'./Services/Search/classes/class.ilRepositorySearchGUI.php';
1356 'auto_complete_name' => $lng->txt(
'user'),
1357 'submit_name' => $lng->txt(
'add')
1368 $this->lng->txt(
'search_user'),
1369 $this->ctrl->getLinkTargetByClass(
'ilRepositorySearchGUI',
'start')
1375 $this->lng->txt(
'role_mailto'),
1376 $this->ctrl->getLinkTarget($this,
'mailToRole')
1378 $this->tpl->setVariable(
'BUTTONS_UA',$tb->getHTML());
1381 include_once
'./Services/PrivacySecurity/classes/class.ilSecuritySettings.php';
1382 $role_assignment_editable =
true;
1384 $this->object->getId() == SYSTEM_ROLE_ID &&
1387 $role_assignment_editable =
false;
1390 include_once
'./Services/AccessControl/classes/class.ilAssignedUsersTableGUI.php';
1393 $this->tpl->setVariable(
'TABLE_UA',$ut->getHTML());
1406 if (
$_GET[
"new_type"] !=
"role")
1408 $this->ctrl->redirect($this,
"userassignment");
1412 $this->ctrl->redirectByClass(
"ilobjrolefoldergui",
"view");
1419 global $rbacsystem,$rbacreview;
1423 if (!is_array(
$_POST[
"role"]))
1426 $this->searchObject();
1431 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.role_usr_selection.html",
"Services/AccessControl");
1432 $this->
__showButton(
"searchUserForm",$this->lng->txt(
"role_new_search"));
1437 foreach (
$_POST[
"role"] as $role_id)
1439 $members = array_merge($rbacreview->assignedUsers($role_id),$members);
1442 $members = array_unique($members);
1446 $f_result = array();
1448 foreach($members as $user)
1455 $user_ids[$counter] = $user;
1459 $f_result[$counter][] = $tmp_obj->getLogin();
1460 $f_result[$counter][] = $tmp_obj->getFirstname();
1461 $f_result[$counter][] = $tmp_obj->getLastname();
1467 $this->__showSearchUserTable($f_result,$user_ids,
"listUsersRole");
1478 foreach ($a_path_arr as
$data)
1485 $path .= $data[
'title'];
1488 if (strlen(
$path) > 50)
1490 return '...'.substr(
$path,-50);
1499 $this->tpl->addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
1500 $this->tpl->addBlockFile(
"STATUSLINE",
"statusline",
"tpl.statusline.html");
1520 $this->tpl->setTitle($this->lng->txt(
'role'));
1521 $this->tpl->setDescription($this->object->getTitle());
1524 $this->
getTabs($this->tabs_gui);
1533 $this->tpl->addBlockFile(
"LOCATOR",
"locator",
"tpl.locator.html",
"Services/Locator");
1537 foreach ($tree->getPathFull($this->rolf_ref_id) as $key =>
$row)
1541 $this->tpl->touchBlock(
'locator_separator_prefix');
1544 $this->tpl->setCurrentBlock(
"locator_item");
1546 if (
$row[
"type"] ==
'rolf')
1548 $this->tpl->setVariable(
"ITEM",$this->object->getTitle());
1549 $this->tpl->setVariable(
"LINK_ITEM",$this->ctrl->getLinkTarget($this));
1551 elseif (
$row[
"child"] != $tree->getRootId())
1553 $ilCtrl->setParameterByClass(
"ilrepositorygui",
"ref_id",
$row[
"child"]);
1554 $this->tpl->setVariable(
"ITEM",
$row[
"title"]);
1555 $this->tpl->setVariable(
"LINK_ITEM",
1556 $ilCtrl->getLinkTargetByClass(
"ilrepositorygui",
""));
1560 $ilCtrl->setParameterByClass(
"ilrepositorygui",
"ref_id",
$row[
"child"]);
1561 $this->tpl->setVariable(
"ITEM", $this->lng->txt(
"repository"));
1562 $this->tpl->setVariable(
"LINK_ITEM",
1563 $ilCtrl->getLinkTargetByClass(
"ilrepositorygui",
""));
1565 $ilCtrl->setParameterByClass(
"ilrepositorygui",
"ref_id",
$_GET[
"ref_id"]);
1567 $this->tpl->parseCurrentBlock();
1570 $this->tpl->setVariable(
"TXT_LOCATOR",$this->lng->txt(
"locator"));
1571 $this->tpl->parseCurrentBlock();
1582 if (
$_GET[
"admin_mode"] ==
"settings"
1583 &&
$_GET[
"ref_id"] == ROLE_FOLDER_ID)
1587 $ilLocator->addItem($this->lng->txt(
"obj_".ilObject::_lookupType(
1589 $this->ctrl->getLinkTargetByClass(
"ilobjrolefoldergui",
"view"));
1591 if (
$_GET[
"obj_id"] > 0)
1593 $ilLocator->addItem($this->object->getTitle(),
1594 $this->ctrl->getLinkTarget($this,
"view"));
1608 global $rbacsystem,$rbacreview, $ilHelp;
1610 $base_role_folder = $rbacreview->getFoldersAssignedToRole($this->object->getId(),
true);
1615 $activate_role_edit =
false;
1620 if (in_array($this->rolf_ref_id,$base_role_folder) ||
1621 (strtolower(
$_GET[
"baseClass"]) ==
"iladministrationgui" &&
1622 $_GET[
"admin_mode"] ==
"settings"))
1624 $activate_role_edit =
true;
1628 $tabs_gui->clearTargets();
1630 $ilHelp->setScreenIdComponent(
"role");
1632 if ($this->back_target !=
"")
1634 $tabs_gui->setBackTarget(
1635 $this->back_target[
"text"],$this->back_target[
"link"]);
1638 if($this->
checkAccess(
'write',
'edit_permission') && $activate_role_edit)
1640 $tabs_gui->addTarget(
"edit_properties",
1641 $this->ctrl->getLinkTarget($this,
"edit"), array(
"edit",
"update"), get_class($this));
1657 $tabs_gui->addTarget(
1658 "default_perm_settings",
1659 $this->ctrl->getLinkTarget($this,
"perm"), array(),get_class($this)
1663 if($this->
checkAccess(
'write',
'edit_permission') && $activate_role_edit && $this->
object->getId() != ANONYMOUS_ROLE_ID)
1665 $tabs_gui->addTarget(
"user_assignment",
1666 $this->ctrl->getLinkTarget($this,
"userassignment"),
1667 array(
"deassignUser",
"userassignment",
"assignUser",
"searchUserForm",
"search"),
1671 if($this->
checkAccess(
'write',
'edit_permission') && $activate_role_edit && $this->
object->getId() != ANONYMOUS_ROLE_ID)
1673 $tabs_gui->addTarget(
"desktop_items",
1674 $this->ctrl->getLinkTarget($this,
"listDesktopItems"),
1675 array(
"listDesktopItems",
"deleteDesktopItems",
"selectDesktopItem",
"askDeleteDesktopItem"),
1680 $tabs_gui->addTarget(
1682 $this->ctrl->getLinkTargetByClass(
'ilExportGUI'),
1694 if(count($obj_ids) > 1)
1696 $_SESSION[
'mail_roles'][] =
'#il_role_'.$this->object->getId();
1700 $_SESSION[
'mail_roles'][] = $rbacreview->getRoleMailboxAddress($this->object->getId());
1703 require_once
'Services/Mail/classes/class.ilMailFormCall.php';
1710 global $rbacsystem,$ilAccess;
1712 $a_perm_obj = $a_perm_obj ? $a_perm_obj : $a_perm_global;
1714 if($this->rolf_ref_id == ROLE_FOLDER_ID)
1716 return $rbacsystem->checkAccess($a_perm_global,$this->rolf_ref_id);
1720 return $ilAccess->checkAccess($a_perm_obj,
'',$this->obj_ref_id);
1732 if(!(
int)
$_POST[
'recursive'] and !is_array(
$_POST[
'recursive_list']))
1738 if($rbacreview->isProtected($this->rolf_ref_id, $this->object->getId()))
1742 return count($rbacreview->getFoldersAssignedToRole($this->object->getId())) > 1;
1748 return count($rbacreview->getFoldersAssignedToRole($this->object->getId())) > 1;
1758 $protected =
$_POST[
'protected'];
1760 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
1762 $form->setFormAction($this->ctrl->getFormAction($this,
'changeExistingObjects'));
1763 $form->setTitle($this->lng->txt(
'rbac_change_existing_confirm_tbl'));
1765 $form->addCommandButton(
'changeExistingObjects', $this->lng->txt(
'change_existing_objects'));
1766 $form->addCommandButton(
'perm',$this->lng->txt(
'cancel'));
1771 serialize(array(
'all')) :
1772 serialize(
$_POST[
'recursive_list'])
1774 $form->addItem($hidden);
1782 $this->lng->txt(
'rbac_keep_local_policies'),
1784 $this->lng->txt(
'rbac_keep_local_policies_info')
1791 $this->lng->txt(
'rbac_keep_local_policies'),
1793 $this->lng->txt(
'rbac_unprotected_keep_local_policies_info')
1797 $rad->addOption($keep);
1802 $this->lng->txt(
'rbac_delete_local_policies'),
1804 $this->lng->txt(
'rbac_delete_local_policies_info')
1810 $this->lng->txt(
'rbac_delete_local_policies'),
1812 $this->lng->txt(
'rbac_unprotected_delete_local_policies_info')
1815 $rad->addOption($del);
1817 $form->addItem($rad);
1818 $this->tpl->setContent($form->getHTML());
1827 global
$tree,$rbacreview,$rbacadmin;
1829 $mode = (int)
$_POST[
'mode'];
1830 $start = ($this->rolf_ref_id == ROLE_FOLDER_ID ? ROOT_FOLDER_ID : $tree->getParentId($this->rolf_ref_id));
1834 $this->ctrl->redirect($this,
'perm');
1848 case 'default_perm_settings':
1849 if($this->rolf_ref_id != ROLE_FOLDER_ID)
1853 $ilTabs->addSubTabTarget(
1854 'rbac_repository_permissions',
1855 $this->ctrl->getLinkTarget($this,
'perm')
1857 $ilTabs->addSubTabTarget(
1858 'rbac_admin_permissions',
1859 $this->ctrl->getLinkTarget($this,
'adminPerm')