4 include_once
'./Services/AccessControl/classes/class.ilPermission2GUI.php';
39 global $rbacsystem,
$ilErr;
42 if (!$rbacsystem->checkAccess(
"edit_permission",$this->gui_obj->object->getRefId()))
44 $ilErr->raiseError($this->lng->txt(
"permission_denied"),$ilErr->MESSAGE);
47 $next_class = $this->ctrl->getNextClass($this);
52 $this->ctrl->setReturn($this,
'perm');
53 include_once(
"Services/AccessControl/classes/class.ilObjRoleGUI.php");
55 $this->gui_obj->setBackTarget($this->lng->txt(
"perm_settings"),$this->ctrl->getLinkTarget($this,
"perm"));
56 $ret = $this->ctrl->forwardCommand($this->gui_obj);
59 case 'ildidactictemplategui':
60 $this->ctrl->setReturn($this,
'perm');
61 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateGUI.php';
63 $this->ctrl->forwardCommand($did);
66 case 'ilrepositorysearchgui':
68 include_once(
'./Services/Search/classes/class.ilRepositorySearchGUI.php');
70 $this->ctrl->forwardCommand($rep_search);
73 case 'ilobjectpermissionstatusgui':
75 include_once(
'./Services/AccessControl/classes/class.ilObjectPermissionStatusGUI.php');
77 $this->ctrl->forwardCommand($perm_stat);
81 $cmd = $this->ctrl->getCmd();
96 return $this->gui_obj->object;
104 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateGUI.php';
105 $this->ctrl->setReturn($this,
'perm');
106 $this->ctrl->setCmdClass(
'ildidactictemplategui');
108 $this->ctrl->forwardCommand($dtpl_gui,
'confirmTemplateSwitch');
118 global $objDefinition, $ilToolbar;
120 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateGUI.php';
122 if($dtpl->appendToolbarSwitch(
124 $this->getCurrentObject()->getType(),
128 $ilToolbar->addSeparator();
131 if($objDefinition->hasLocalRoles($this->getCurrentObject()->getType()) and
135 $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
139 $ilToolbar->addButton($this->lng->txt(
'rbac_add_new_local_role'),$this->ctrl->getLinkTarget($this,
'displayAddRoleForm'));
141 $ilToolbar->addButton($this->lng->txt(
'rbac_import_role'),$this->ctrl->getLinkTarget($this,
'displayImportRoleForm'));
148 include_once
'./Services/AccessControl/classes/class.ilObjectRolePermissionTableGUI.php';
152 $this->tpl->setContent($table->getHTML());
187 include_once
'./Services/AccessControl/classes/class.ilObjectRolePermissionTableGUI.php';
189 $table->resetOffset();
190 $table->writeFilterToSession();
191 return $this->
perm($table);
200 include_once
'./Services/AccessControl/classes/class.ilObjectRolePermissionTableGUI.php';
202 $table->resetOffset();
203 $table->resetFilter();
205 return $this->
perm($table);
218 if(isset($a_roles[SYSTEM_ROLE_ID]))
220 unset($a_roles[SYSTEM_ROLE_ID]);
223 switch ($a_filter_id)
233 $arr_global_roles = $rbacreview->getGlobalRoles();
234 $arr_remove_roles = array_diff(array_keys($a_roles),$arr_global_roles);
236 foreach ($arr_remove_roles as $role_id)
238 unset($a_roles[$role_id]);
244 $arr_global_roles = $rbacreview->getGlobalRoles();
246 foreach ($arr_global_roles as $role_id)
248 unset($a_roles[$role_id]);
258 $arr_remove_roles = array_diff(array_keys($a_roles),$arr_local_roles);
260 foreach ($arr_remove_roles as $role_id)
262 unset($a_roles[$role_id]);
271 $arr_remove_roles = array_diff(array_keys($a_roles),$arr_local_roles);
273 foreach ($arr_remove_roles as $role_id)
275 unset($a_roles[$role_id]);
291 global $rbacreview,$objDefinition,$rbacadmin;
293 include_once
'./Services/AccessControl/classes/class.ilObjectRolePermissionTableGUI.php';
297 $rbacreview->getParentRoleIds($this->getCurrentObject()->getRefId()),
298 $table->getFilterItemByPostVar(
'role')->getValue()
302 include_once
"Services/AccessControl/classes/class.ilRbacLog.php";
306 # all possible create permissions
307 $possible_ops_ids = $rbacreview->getOperationsByTypeAndClass(
312 # createable (activated) create permissions
313 $create_types = $objDefinition->getCreatableSubObjects(
318 foreach((array) $roles as $role => $role_data)
320 if($role_data[
'protected'])
325 $new_ops = array_keys((array)
$_POST[
'perm'][$role]);
326 $old_ops = $rbacreview->getRoleOperationsOnObject(
332 foreach($possible_ops_ids as $create_ops_id)
334 if(in_array($create_ops_id,$createable_ops_ids))
338 if(in_array($create_ops_id,$old_ops))
340 $new_ops[] = $create_ops_id;
344 $rbacadmin->revokePermission(
349 $rbacadmin->grantPermission(
351 array_unique($new_ops),
358 foreach($roles as $role)
361 if($role[
'parent'] == $this->
getCurrentObject()->getRefId() and $role[
'assign'] ==
'y')
366 if($role[
'protected'])
371 if($role[
'parent'] == $this->
getCurrentObject()->getRefId() and !isset(
$_POST[
'inherit'][$role[
'obj_id']]))
379 if($role[
'parent'] != $this->
getCurrentObject()->getRefId() and isset(
$_POST[
'inherit'][$role[
'obj_id']]))
381 $rbacadmin->copyRoleTemplatePermissions(
387 $rbacadmin->assignRoleToFolder($role[
'obj_id'],$this->
getCurrentObject()->getRefId(),
'n');
395 foreach($roles as $role)
397 if($rbacreview->isAssignable($role[
'obj_id'], $this->getCurrentObject()->getRefId()))
399 if(isset(
$_POST[
'protect'][$role[
'obj_id']]) and
400 !$rbacreview->isProtected($this->
getCurrentObject()->getRefId(), $role[
'obj_id']))
402 $rbacadmin->setProtected($this->
getCurrentObject()->getRefId(), $role[
'obj_id'],
'y');
404 elseif(!isset(
$_POST[
'protect'][$role[
'obj_id']]) and
405 $rbacreview->isProtected($this->getCurrentObject()->getRefId(), $role[
'obj_id']))
407 $rbacadmin->setProtected($this->
getCurrentObject()->getRefId(), $role[
'obj_id'],
'n');
417 if(count((array)
$_POST[
'block']))
424 #$this->ctrl->redirect($this,'perm');
437 include_once
'./Services/Utilities/classes/class.ilConfirmationGUI.php';
439 $confirm->setFormAction($this->ctrl->getFormAction($this));
440 $confirm->setHeaderText($this->lng->txt(
'role_confirm_block_role_header'));
441 $confirm->setConfirm($this->lng->txt(
'role_block_role'),
'blockRoles');
442 $confirm->setCancel($this->lng->txt(
'cancel'),
'perm');
444 foreach($a_roles as $role_id)
446 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
453 $this->tpl->setContent($confirm->getHTML());
463 global $rbacadmin,$rbacreview;
466 foreach($roles as $role)
469 $assign = $rbacreview->isAssignable($role, $this->
getCurrentObject()->getRefId()) ?
'y' :
'n';
472 $rbacadmin->revokeSubtreePermissions($this->
getCurrentObject()->getRefId(), $role);
475 $rbacadmin->deleteSubtreeTemplates($this->
getCurrentObject()->getRefId(), $role);
478 $rbacadmin->assignRoleToFolder(
486 $this->ctrl->redirect($this,
'perm');
497 global $objDefinition;
499 return $objDefinition->isContainer($a_type) and $a_type !=
'root' and $a_type !=
'adm' and $a_type !=
'rolf';
514 $GLOBALS[
'tpl']->setContent($form->getHTML());
525 if($form->checkInput())
529 include_once
'./Services/Export/classes/class.ilImport.php';
542 $imp->getMapping()->addMapping(
543 'Services/AccessControl',
551 $_FILES[
"importfile"][
"tmp_name"],
552 $_FILES[
"importfile"][
"name"],
556 $this->ctrl->redirect($this,
'perm');
562 $form->setValuesByPost();
567 $form->setValuesByPost();
577 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
579 $form->setFormAction($this->ctrl->getFormAction($this));
580 $form->setTitle($this->lng->txt(
'rbac_import_role'));
581 $form->addCommandButton(
'doImportRole', $this->lng->txt(
'import'));
582 $form->addCommandButton(
'perm', $this->lng->txt(
'cancel'));
584 $zip =
new ilFileInputGUI($this->lng->txt(
'import_file'),
'importfile');
586 $form->addItem($zip);
599 global $rbacreview,$objDefinition;
601 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
603 $form->setFormAction($this->ctrl->getFormAction($this));
604 $form->setTitle($this->lng->txt(
'role_new'));
605 $form->addCommandButton(
'addrole',$this->lng->txt(
'role_new'));
606 $form->addCommandButton(
'perm', $this->lng->txt(
'cancel'));
610 $title->setValidationFailureMessage($this->lng->txt(
'msg_role_reserved_prefix'));
612 $title->setMaxLength(70);
613 $title->setRequired(
true);
614 $form->addItem($title);
619 $form->addItem($desc);
622 $pro->
setInfo($this->lng->txt(
'role_protect_permissions_desc'));
624 $form->addItem($pro);
627 $pd->
setInfo($this->lng->txt(
'rbac_role_add_to_desktop_info'));
635 $option =
new ilRadioOption($this->lng->txt(
"rbac_role_rights_copy_empty"), 0);
636 $rights->addOption($option);
638 $parent_role_ids = $rbacreview->getParentRoleIds($this->gui_obj->object->getRefId(),
true);
640 foreach($parent_role_ids as $id => $tmp)
646 $sorted_ids =
ilUtil::_sortIds($ids,
'object_data',
'type DESC,title',
'obj_id');
649 foreach($sorted_ids as $id)
651 $par = $parent_role_ids[$id];
652 if ($par[
"obj_id"] != SYSTEM_ROLE_ID)
654 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
656 $option->
setInfo($par[
"desc"]);
657 $rights->addOption($option);
661 $form->addItem($rights);
665 if($objDefinition->isContainer($this->getCurrentObject()->getType()))
667 $check =
new ilCheckboxInputGui($this->lng->txt(
"rbac_role_rights_copy_change_existing"),
'existing');
668 $check->setInfo($this->lng->txt(
'rbac_change_existing_objects_desc_new_role'));
669 $form->addItem($check);
684 $this->tpl->setContent($form->getHTML());
700 if($form->checkInput())
702 $new_title = $form->getInput(
"title");
704 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
706 $role->setTitle($new_title);
707 $role->setDescription($form->getInput(
'desc'));
713 $rbacadmin->setProtected(
716 $form->getInput(
'pro') ?
'y' :
'n'
720 $right_id_to_copy = $form->getInput(
"rights");
721 if($right_id_to_copy)
723 $parentRoles = $rbacreview->getParentRoleIds($this->
getCurrentObject()->getRefId(),
true);
724 $rbacadmin->copyRoleTemplatePermissions(
726 $parentRoles[$right_id_to_copy][
"parent"],
731 if($form->getInput(
'existing'))
733 if($form->getInput(
'pro'))
735 $role->changeExistingObjects(
743 $role->changeExistingObjects(
753 if($form->getInput(
"desktop"))
755 include_once
'Services/AccessControl/classes/class.ilRoleDesktopItem.php';
757 $role_desk_item_obj->
add(
763 $this->ctrl->redirect($this,
'perm');
767 $form->setValuesByPost();
768 $this->tpl->setContent($form->getHTML());