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'));
478 $title->setDisabled(
true);
480 $title->setValidationRegexp(
'/^(?!il_).*$/');
481 $title->setValidationFailureMessage($this->lng->txt(
'msg_role_reserved_prefix'));
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);
534 $role->
setTitle($this->form->getInput(
'title'));
551 include_once
'Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php';
561 $data[
'pro'] = $rbacreview->isProtected($this->rolf_ref_id, $role->
getId());
563 $this->form->setValuesByArray(
$data);
578 if(!$rbacsystem->checkAccess(
'create_role',$this->rolf_ref_id))
580 $ilErr->raiseError($this->lng->txt(
'permission_denied'),
$ilErr->MESSAGE);
584 $this->tpl->setContent($this->form->getHTML());
597 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),$ilErr->MESSAGE);
601 $this->tpl->setContent($this->form->getHTML());
611 global $rbacadmin,$rbacreview;
616 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
618 $this->role->create();
620 $rbacadmin->setProtected(
622 $this->role->getId(),
623 $this->form->getInput(
'pro') ?
'y' :
'n'
626 $this->ctrl->returnToParent($this);
630 $this->form->setValuesByPost();
631 $this->tpl->setContent($this->form->getHTML());
643 foreach($rbacreview->getRolesOfRoleFolder($this->rolf_ref_id) as $role_id)
645 if($role_id == $a_role_id)
651 if(strcmp(
$title, trim($this->form->getInput(
'title'))) === 0)
653 $this->form->getItemByPostVar(
'title')->setAlert($this->lng->txt(
'rbac_role_exists_alert'));
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 $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
718 $ilToolbar->addButton(
719 $this->lng->txt(
"adopt_perm_from_template"),
720 $this->ctrl->getLinkTarget($this,
'adoptPerm')
724 $ilToolbar->addButton(
725 $this->lng->txt(
'rbac_delete_role'),
726 $this->ctrl->getLinkTarget($this,
'confirmDeleteRole')
730 $this->tpl->addBlockFile(
733 'tpl.rbac_template_permissions.html',
734 'Services/AccessControl'
737 $this->tpl->setVariable(
'PERM_ACTION',$this->ctrl->getFormAction($this));
739 include_once
'./Services/Accordion/classes/class.ilAccordionGUI.php';
744 if($this->rolf_ref_id == ROLE_FOLDER_ID)
746 if($a_show_admin_permissions)
748 $subs = $objDefinition->getSubObjectsRecursively(
'adm',
true,
true);
752 $subs = $objDefinition->getSubObjectsRecursively(
'root',
true,$a_show_admin_permissions);
757 $subs = $objDefinition->getSubObjectsRecursively($this->
getParentType(),
true,$a_show_admin_permissions);
761 foreach($subs as $subtype => $def)
763 if($objDefinition->isPlugin($subtype))
767 elseif($objDefinition->isSystemObject($subtype))
769 $translation = $this->lng->txt(
"obj_".$subtype);
773 $translation = $this->lng->txt(
'objs_'.$subtype);
776 $sorted[$subtype] = $def;
777 $sorted[$subtype][
'translation'] = $translation;
782 foreach($sorted as $subtype => $def)
784 if($objDefinition->isPlugin($subtype))
788 elseif($objDefinition->isSystemObject($subtype))
790 $translation = $this->lng->txt(
"obj_".$subtype);
794 $translation = $this->lng->txt(
'objs_'.$subtype);
797 include_once
'Services/AccessControl/classes/class.ilObjectRoleTemplatePermissionTableGUI.php';
802 $this->object->getId(),
804 $a_show_admin_permissions
808 $acc->addItem($translation, $tbl->getHTML());
811 $this->tpl->setVariable(
'ACCORDION',$acc->getHTML());
814 include_once
'./Services/AccessControl/classes/class.ilObjectRoleTemplateOptionsTableGUI.php';
819 $this->object->getId(),
820 $a_show_admin_permissions
823 $a_show_admin_permissions ?
'adminPermSave' :
'permSave',
824 $this->lng->txt(
'save')
828 $this->tpl->setVariable(
'OPTIONS_TABLE',$options->getHTML());
855 $parent_role_ids = $rbacreview->getParentRoleIds($this->rolf_ref_id,
true);
857 foreach($parent_role_ids as $id => $tmp)
865 foreach($sorted_ids as $id)
867 $par = $parent_role_ids[$id];
868 if ($par[
"obj_id"] != SYSTEM_ROLE_ID && $this->object->getId() != $par[
"obj_id"])
871 $output[
"adopt"][$key][
"css_row_adopt"] = ($key % 2 == 0) ?
"tblrow1" :
"tblrow2";
872 $output[
"adopt"][$key][
"check_adopt"] = $radio;
873 $output[
"adopt"][$key][
"role_id"] = $par[
"obj_id"];
874 $output[
"adopt"][$key][
"type"] = ($par[
"type"] ==
'role' ? $this->lng->txt(
'obj_role') : $this->lng->txt(
'obj_rolt'));
876 $output[
"adopt"][$key][
"role_desc"] = $par[
"desc"];
881 $output[
"formaction_adopt"] = $this->ctrl->getFormAction($this);
882 $output[
"message_middle"] = $this->lng->txt(
"adopt_perm_from_template");
885 $tpl =
new ilTemplate(
"tpl.adm_copy_role.html",
true,
true,
"Services/AccessControl");
887 $tpl->setCurrentBlock(
"ADOPT_PERM_ROW");
888 foreach ($output[
"adopt"] as $key => $value)
890 $tpl->setVariable(
"CSS_ROW_ADOPT",$value[
"css_row_adopt"]);
891 $tpl->setVariable(
"CHECK_ADOPT",$value[
"check_adopt"]);
892 $tpl->setVariable(
"LABEL_ID",$value[
"role_id"]);
893 $tpl->setVariable(
"TYPE",$value[
"type"]);
894 $tpl->setVariable(
"ROLE_NAME",$value[
"role_name"]);
895 if(strlen($value[
'role_desc']))
897 $tpl->setVariable(
'ROLE_DESC',$value[
'role_desc']);
899 $tpl->parseCurrentBlock();
902 $tpl->setVariable(
"TPLPATH",$this->tpl->tplPath);
903 $tpl->setVariable(
"MESSAGE_MIDDLE",$output[
"message_middle"]);
904 $tpl->setVariable(
"FORMACTION_ADOPT",$output[
"formaction_adopt"]);
905 $tpl->setVariable(
"ADOPT",$this->lng->txt(
'copy'));
906 $tpl->setVariable(
"CANCEL",$this->lng->txt(
'cancel'));
908 $tpl->setVariable(
'HEAD_ROLE',$this->lng->txt(
'title'));
909 $tpl->setVariable(
'HEAD_TYPE',$this->lng->txt(
'type'));
911 $this->tpl->setContent(
$tpl->get());
922 $access = $this->
checkAccess(
'visible,write',
'edit_permission');
925 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_perm'),$ilErr->WARNING);
928 $question = $this->lng->txt(
'rbac_role_delete_qst');
929 if($rbacreview->isAssigned($ilUser->getId(), $this->
object->getId()))
931 $question .= (
'<br />'.$this->lng->txt(
'rbac_role_delete_self'));
935 include_once
'./Services/Utilities/classes/class.ilConfirmationGUI.php';
938 $confirm->setFormAction($this->ctrl->getFormAction($this));
939 $confirm->setHeaderText($question);
940 $confirm->setCancel($this->lng->txt(
'cancel'),
'perm');
941 $confirm->setConfirm($this->lng->txt(
'rbac_delete_role'),
'performDeleteRole');
945 $this->object->getId(),
946 $this->
object->getTitle(),
950 $this->tpl->setContent($confirm->getHTML());
963 $access = $this->
checkAccess(
'visible,write',
'edit_permission');
966 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_perm'),$ilErr->WARNING);
969 $this->
object->setParent((
int)
$_GET[
'rolf_ref_id']);
970 $this->
object->delete();
973 $this->ctrl->returnToParent($this);
996 $access = $this->
checkAccess(
'visible,write',
'edit_permission');
1000 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_perm"),$this->ilias->error_obj->MESSAGE);
1004 include_once
"Services/AccessControl/classes/class.ilRbacLog.php";
1006 if($rbac_log_active)
1012 if($this->rolf_ref_id == ROLE_FOLDER_ID)
1014 if($a_show_admin_permissions)
1016 $subs = $objDefinition->getSubObjectsRecursively(
'adm',
true,
true);
1020 $subs = $objDefinition->getSubObjectsRecursively(
'root',
true,
false);
1025 $subs = $objDefinition->getSubObjectsRecursively($this->
getParentType(),
true,
false);
1028 foreach($subs as $subtype => $def)
1031 $rbacadmin->deleteRolePermission($this->object->getId(),
$this->rolf_ref_id,$subtype);
1034 if (empty(
$_POST[
"template_perm"]))
1036 $_POST[
"template_perm"] = array();
1039 foreach (
$_POST[
"template_perm"] as $key => $ops_array)
1042 $rbacadmin->setRolePermission($this->object->getId(), $key, $ops_array,
$this->rolf_ref_id);
1045 if($rbac_log_active)
1053 $this->
object->update();
1056 if ($this->rolf_ref_id == ROLE_FOLDER_ID or $rbacreview->isAssignable($this->object->getId(),
$this->rolf_ref_id))
1058 $rbacadmin->setProtected($this->rolf_ref_id,$this->object->getId(),
ilUtil::tf2yn(
$_POST[
'protected']));
1061 if($a_show_admin_permissions)
1063 $_POST[
'recursive'] =
true;
1067 if(!
$_POST[
'recursive'] and !is_array(
$_POST[
'recursive_list']))
1070 if($a_show_admin_permissions)
1072 $this->ctrl->redirect($this,
'adminPerm');
1076 $this->ctrl->redirect($this,
'perm');
1086 $start = ($this->rolf_ref_id == ROLE_FOLDER_ID ? ROOT_FOLDER_ID : $tree->getParentId($this->rolf_ref_id));
1087 if($a_show_admin_permissions)
1089 $start = $tree->getParentId($this->rolf_ref_id);
1094 $this->
object->changeExistingObjects(
1099 #$a_show_admin_permissions ? array(
'adm') : array()
1104 $this->
object->changeExistingObjects(
1109 #$a_show_admin_permissions ? array(
'adm') : array()
1114 if($a_show_admin_permissions)
1116 $this->ctrl->redirect($this,
'adminPerm');
1120 $this->ctrl->redirect($this,
'perm');
1133 global $rbacadmin, $rbacsystem, $rbacreview,
$tree;
1142 $access = $this->
checkAccess(
'visible,write',
'edit_permission');
1145 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_perm"),$this->ilias->error_obj->MESSAGE);
1148 if ($this->object->getId() ==
$_POST[
"adopt"])
1155 $parentRoles = $rbacreview->getParentRoleIds($this->rolf_ref_id,
true);
1156 $rbacadmin->copyRoleTemplatePermissions(
1158 $parentRoles[
$_POST[
"adopt"]][
"parent"],
1160 $this->object->getId(),
1164 $this->
object->update();
1167 $obj_data =& $this->ilias->obj_factory->getInstanceByObjId($_POST[
"adopt"]);
1168 ilUtil::sendSuccess($this->lng->txt(
"msg_perm_adopted_from1").
" '".$obj_data->getTitle().
"'.<br/>".
1169 $this->lng->txt(
"msg_perm_adopted_from2"),
true);
1172 $this->ctrl->redirect($this,
"perm");
1182 $this->assignUserObject();
1194 global $rbacreview,$rbacadmin;
1196 if(!$this->
checkAccess(
'edit_userassignment',
'edit_permission'))
1202 $this->rolf_ref_id != ROLE_FOLDER_ID)
1209 $GLOBALS[
'lng']->loadLanguageModule(
'search');
1214 $assigned_users_all = $rbacreview->assignedUsers($this->object->getId());
1217 $assigned_users_new = array_diff($a_user_ids,array_intersect($a_user_ids,$assigned_users_all));
1220 if (count($assigned_users_new) == 0)
1223 $this->ctrl->redirect($this,
'userassignment');
1227 foreach ($assigned_users_new as $user)
1229 $rbacadmin->assignUser($this->object->getId(),$user,
false);
1233 $this->
object->update();
1236 $this->ctrl->redirect($this,
'userassignment');
1246 global $rbacsystem, $rbacadmin, $rbacreview;
1248 #if (!$rbacsystem->checkAccess("edit_userassignment", $this->rolf_ref_id))
1249 if(!$this->
checkAccess(
'edit_userassignment',
'edit_permission'))
1251 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_assign_user_to_role"),$this->ilias->error_obj->MESSAGE);
1254 $selected_users = (
$_POST[
"user_id"]) ?
$_POST[
"user_id"] : array(
$_GET[
"user_id"]);
1256 if ($selected_users[0]=== NULL)
1258 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
1262 if ($this->object->getId() == SYSTEM_ROLE_ID)
1264 if ($admin = array_search(SYSTEM_USER_ID,$selected_users) !==
false)
1265 unset($selected_users[$admin]);
1269 $last_role = array();
1270 $global_roles = $rbacreview->getGlobalRoles();
1272 foreach ($selected_users as $user)
1274 $assigned_roles = $rbacreview->assignedRoles($user);
1275 $assigned_global_roles = array_intersect($assigned_roles,$global_roles);
1277 if (count($assigned_roles) == 1 or (count($assigned_global_roles) == 1 and in_array($this->object->getId(),$assigned_global_roles)))
1279 $userObj = $this->ilias->obj_factory->getInstanceByObjId($user);
1280 $last_role[$user] = $userObj->getFullName();
1287 foreach ($selected_users as $user)
1289 if(!isset($last_role[$user]))
1291 $rbacadmin->deassignUser($this->object->getId(), $user);
1296 $this->
object->update();
1299 if(count($last_role))
1301 $user_list = implode(
", ",$last_role);
1302 ilUtil::sendFailure($this->lng->txt(
'msg_is_last_role').
': '.$user_list.
'<br />'.$this->lng->txt(
'msg_min_one_role'),
true);
1308 $this->ctrl->redirect($this,
'userassignment');
1320 if(!$this->
checkAccess(
'edit_userassignment',
'edit_permission'))
1322 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_assign_user_to_role"),$this->ilias->error_obj->MESSAGE);
1325 $this->tabs_gui->setTabActive(
'user_assignment');
1327 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.rbac_ua.html',
'Services/AccessControl');
1329 include_once
'./Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
1333 include_once
'./Services/PrivacySecurity/classes/class.ilSecuritySettings.php';
1335 $this->object->getId() != SYSTEM_ROLE_ID ||
1337 !$rbacreview->isAssigned($ilUser->getId(),SYSTEM_ROLE_ID) or
1345 include_once
'./Services/Search/classes/class.ilRepositorySearchGUI.php';
1350 'auto_complete_name' => $lng->txt(
'user'),
1351 'submit_name' => $lng->txt(
'add')
1362 $this->lng->txt(
'search_user'),
1363 $this->ctrl->getLinkTargetByClass(
'ilRepositorySearchGUI',
'start')
1369 $this->lng->txt(
'role_mailto'),
1370 $this->ctrl->getLinkTarget($this,
'mailToRole')
1372 $this->tpl->setVariable(
'BUTTONS_UA',$tb->getHTML());
1375 include_once
'./Services/PrivacySecurity/classes/class.ilSecuritySettings.php';
1376 $role_assignment_editable =
true;
1378 $this->object->getId() == SYSTEM_ROLE_ID &&
1381 $role_assignment_editable =
false;
1384 include_once
'./Services/AccessControl/classes/class.ilAssignedUsersTableGUI.php';
1387 $this->tpl->setVariable(
'TABLE_UA',$ut->getHTML());
1400 if (
$_GET[
"new_type"] !=
"role")
1402 $this->ctrl->redirect($this,
"userassignment");
1406 $this->ctrl->redirectByClass(
"ilobjrolefoldergui",
"view");
1413 global $rbacsystem,$rbacreview;
1417 if (!is_array(
$_POST[
"role"]))
1420 $this->searchObject();
1425 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.role_usr_selection.html",
"Services/AccessControl");
1426 $this->
__showButton(
"searchUserForm",$this->lng->txt(
"role_new_search"));
1431 foreach (
$_POST[
"role"] as $role_id)
1433 $members = array_merge($rbacreview->assignedUsers($role_id),$members);
1436 $members = array_unique($members);
1440 $f_result = array();
1442 foreach($members as $user)
1449 $user_ids[$counter] = $user;
1453 $f_result[$counter][] = $tmp_obj->getLogin();
1454 $f_result[$counter][] = $tmp_obj->getFirstname();
1455 $f_result[$counter][] = $tmp_obj->getLastname();
1461 $this->__showSearchUserTable($f_result,$user_ids,
"listUsersRole");
1472 foreach ($a_path_arr as
$data)
1479 $path .= $data[
'title'];
1482 if (strlen(
$path) > 50)
1484 return '...'.substr(
$path,-50);
1493 $this->tpl->addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
1494 $this->tpl->addBlockFile(
"STATUSLINE",
"statusline",
"tpl.statusline.html");
1514 $this->tpl->setTitle($this->lng->txt(
'role'));
1515 $this->tpl->setDescription($this->object->getTitle());
1518 $this->
getTabs($this->tabs_gui);
1527 $this->tpl->addBlockFile(
"LOCATOR",
"locator",
"tpl.locator.html",
"Services/Locator");
1531 foreach ($tree->getPathFull($this->rolf_ref_id) as $key =>
$row)
1535 $this->tpl->touchBlock(
'locator_separator_prefix');
1538 $this->tpl->setCurrentBlock(
"locator_item");
1540 if (
$row[
"type"] ==
'rolf')
1542 $this->tpl->setVariable(
"ITEM",$this->object->getTitle());
1543 $this->tpl->setVariable(
"LINK_ITEM",$this->ctrl->getLinkTarget($this));
1545 elseif (
$row[
"child"] != $tree->getRootId())
1547 $ilCtrl->setParameterByClass(
"ilrepositorygui",
"ref_id",
$row[
"child"]);
1548 $this->tpl->setVariable(
"ITEM",
$row[
"title"]);
1549 $this->tpl->setVariable(
"LINK_ITEM",
1550 $ilCtrl->getLinkTargetByClass(
"ilrepositorygui",
""));
1554 $ilCtrl->setParameterByClass(
"ilrepositorygui",
"ref_id",
$row[
"child"]);
1555 $this->tpl->setVariable(
"ITEM", $this->lng->txt(
"repository"));
1556 $this->tpl->setVariable(
"LINK_ITEM",
1557 $ilCtrl->getLinkTargetByClass(
"ilrepositorygui",
""));
1559 $ilCtrl->setParameterByClass(
"ilrepositorygui",
"ref_id",
$_GET[
"ref_id"]);
1561 $this->tpl->parseCurrentBlock();
1564 $this->tpl->setVariable(
"TXT_LOCATOR",$this->lng->txt(
"locator"));
1565 $this->tpl->parseCurrentBlock();
1576 if (
$_GET[
"admin_mode"] ==
"settings"
1577 &&
$_GET[
"ref_id"] == ROLE_FOLDER_ID)
1579 $ilLocator->addItem($this->lng->txt(
"administration"),
1580 $this->ctrl->getLinkTargetByClass(
"iladministrationgui",
"frameset"),
1583 $ilLocator->addItem($this->lng->txt(
"obj_".ilObject::_lookupType(
1585 $this->ctrl->getLinkTargetByClass(
"ilobjrolefoldergui",
"view"));
1587 if (
$_GET[
"obj_id"] > 0)
1589 $ilLocator->addItem($this->object->getTitle(),
1590 $this->ctrl->getLinkTarget($this,
"view"));
1604 global $rbacsystem,$rbacreview, $ilHelp;
1606 $base_role_folder = $rbacreview->getFoldersAssignedToRole($this->object->getId(),
true);
1611 $activate_role_edit =
false;
1616 if (in_array($this->rolf_ref_id,$base_role_folder) ||
1617 (strtolower(
$_GET[
"baseClass"]) ==
"iladministrationgui" &&
1618 $_GET[
"admin_mode"] ==
"settings"))
1620 $activate_role_edit =
true;
1624 $tabs_gui->clearTargets();
1626 $ilHelp->setScreenIdComponent(
"role");
1628 if ($this->back_target !=
"")
1630 $tabs_gui->setBackTarget(
1631 $this->back_target[
"text"],$this->back_target[
"link"]);
1634 if($this->
checkAccess(
'write',
'edit_permission') && $activate_role_edit)
1636 $tabs_gui->addTarget(
"edit_properties",
1637 $this->ctrl->getLinkTarget($this,
"edit"), array(
"edit",
"update"), get_class($this));
1653 $tabs_gui->addTarget(
1654 "default_perm_settings",
1655 $this->ctrl->getLinkTarget($this,
"perm"), array(),get_class($this)
1659 if($this->
checkAccess(
'write',
'edit_permission') && $activate_role_edit && $this->
object->getId() != ANONYMOUS_ROLE_ID)
1661 $tabs_gui->addTarget(
"user_assignment",
1662 $this->ctrl->getLinkTarget($this,
"userassignment"),
1663 array(
"deassignUser",
"userassignment",
"assignUser",
"searchUserForm",
"search"),
1667 if($this->
checkAccess(
'write',
'edit_permission') && $activate_role_edit && $this->
object->getId() != ANONYMOUS_ROLE_ID)
1669 $tabs_gui->addTarget(
"desktop_items",
1670 $this->ctrl->getLinkTarget($this,
"listDesktopItems"),
1671 array(
"listDesktopItems",
"deleteDesktopItems",
"selectDesktopItem",
"askDeleteDesktopItem"),
1676 $tabs_gui->addTarget(
1678 $this->ctrl->getLinkTargetByClass(
'ilExportGUI'),
1690 if(count($obj_ids) > 1)
1692 $_SESSION[
'mail_roles'][] =
'#il_role_'.$this->object->getId();
1696 $_SESSION[
'mail_roles'][] = $rbacreview->getRoleMailboxAddress($this->object->getId());
1699 require_once
'Services/Mail/classes/class.ilMailFormCall.php';
1706 global $rbacsystem,$ilAccess;
1708 $a_perm_obj = $a_perm_obj ? $a_perm_obj : $a_perm_global;
1710 if($this->rolf_ref_id == ROLE_FOLDER_ID)
1712 return $rbacsystem->checkAccess($a_perm_global,$this->rolf_ref_id);
1716 return $ilAccess->checkAccess($a_perm_obj,
'',$this->obj_ref_id);
1728 if(!(
int)
$_POST[
'recursive'] and !is_array(
$_POST[
'recursive_list']))
1734 if($rbacreview->isProtected($this->rolf_ref_id, $this->object->getId()))
1738 return count($rbacreview->getFoldersAssignedToRole($this->object->getId())) > 1;
1744 return count($rbacreview->getFoldersAssignedToRole($this->object->getId())) > 1;
1754 $protected =
$_POST[
'protected'];
1756 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
1758 $form->setFormAction($this->ctrl->getFormAction($this,
'changeExistingObjects'));
1759 $form->setTitle($this->lng->txt(
'rbac_change_existing_confirm_tbl'));
1761 $form->addCommandButton(
'changeExistingObjects', $this->lng->txt(
'change_existing_objects'));
1762 $form->addCommandButton(
'perm',$this->lng->txt(
'cancel'));
1767 serialize(array(
'all')) :
1768 serialize(
$_POST[
'recursive_list'])
1770 $form->addItem($hidden);
1778 $this->lng->txt(
'rbac_keep_local_policies'),
1780 $this->lng->txt(
'rbac_keep_local_policies_info')
1787 $this->lng->txt(
'rbac_keep_local_policies'),
1789 $this->lng->txt(
'rbac_unprotected_keep_local_policies_info')
1793 $rad->addOption($keep);
1798 $this->lng->txt(
'rbac_delete_local_policies'),
1800 $this->lng->txt(
'rbac_delete_local_policies_info')
1806 $this->lng->txt(
'rbac_delete_local_policies'),
1808 $this->lng->txt(
'rbac_unprotected_delete_local_policies_info')
1811 $rad->addOption($del);
1813 $form->addItem($rad);
1814 $this->tpl->setContent($form->getHTML());
1823 global
$tree,$rbacreview,$rbacadmin;
1825 $mode = (int)
$_POST[
'mode'];
1826 $start = ($this->rolf_ref_id == ROLE_FOLDER_ID ? ROOT_FOLDER_ID : $tree->getParentId($this->rolf_ref_id));
1830 $this->ctrl->redirect($this,
'perm');
1844 case 'default_perm_settings':
1845 if($this->rolf_ref_id != ROLE_FOLDER_ID)
1849 $ilTabs->addSubTabTarget(
1850 'rbac_repository_permissions',
1851 $this->ctrl->getLinkTarget($this,
'perm')
1853 $ilTabs->addSubTabTarget(
1854 'rbac_admin_permissions',
1855 $this->ctrl->getLinkTarget($this,
'adminPerm')