24require_once
"./Services/Object/classes/class.ilObjectGUI.php";
56 parent::__construct($a_data,$a_id,$a_call_by_reference,
false);
57 $lng->loadLanguageModule(
'rbac');
64 $next_class = $this->ctrl->getNextClass($this);
65 $cmd = $this->ctrl->getCmd();
71 case 'ilpermissiongui':
72 include_once(
"Services/AccessControl/classes/class.ilPermissionGUI.php");
74 $ret =& $this->ctrl->forwardCommand($perm_gui);
98 global
$ilErr, $rbacsystem, $ilToolbar,$rbacreview,$ilTabs;
100 $ilTabs->activateTab(
'view');
102 if(!$rbacsystem->checkAccess(
'visible,read',$this->object->getRefId()))
104 $ilErr->raiseError($this->lng->txt(
'permission_denied'),
$ilErr->MESSAGE);
108 if($rbacsystem->checkAccess(
'create_role', $this->object->getRefId()))
110 $this->ctrl->setParameter($this,
'new_type',
'role');
111 $ilToolbar->addButton(
112 $this->lng->txt(
'rolf_create_role'),
113 $this->ctrl->getLinkTarget($this,
'create')
116 if($rbacsystem->checkAccess(
'create_rolt', $this->object->getRefId()))
119 $this->ctrl->setParameter($this,
'new_type',
'rolt');
120 $ilToolbar->addButton(
121 $this->lng->txt(
'rolf_create_rolt'),
122 $this->ctrl->getLinkTarget($this,
'create')
124 $this->ctrl->clearParameters($this);
128 $rbacsystem->checkAccess(
'create_rolt', $this->object->getRefId()) ||
129 $rbacsystem->checkAccess(
'create_rolt', $this->object->getRefId())
132 $ilToolbar->addButton(
133 $this->lng->txt(
'rbac_import_role'),
134 $this->ctrl->getLinkTargetByClass(
'ilPermissionGUI',
'displayImportRoleForm')
138 include_once
'./Services/AccessControl/classes/class.ilRoleTableGUI.php';
141 $table->parse($this->object->getId());
143 $this->tpl->setContent($table->getHTML());
151 global $rbacsystem,
$ilCtrl, $ilTabs;
153 $ilTabs->clearTargets();
154 $ilTabs->setBackTarget(
155 $this->lng->txt(
'rbac_back_to_overview'),
156 $this->ctrl->getLinkTarget($this,
'view')
159 if(!$rbacsystem->checkAccess(
'visible,read',$this->object->getRefId()))
161 $ilErr->raiseError($this->lng->txt(
'permission_denied'),
$ilErr->MESSAGE);
164 $ilCtrl->setParameter($this,
'copy_source',(
int) $_REQUEST[
'copy_source']);
168 $this->tpl->setContent($form->getHTML());
178 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
180 $form->setTitle($this->lng->txt(
'rbac_role_title'));
181 $form->setFormAction(
$ilCtrl->getFormAction($this,
'view'));
184 $search->setRequired(
true);
185 $search->setSize(30);
186 $search->setMaxLength(255);
187 $form->addItem($search);
189 $form->addCommandButton(
'roleSearchForm', $this->lng->txt(
'search'));
204 $ilCtrl->setParameter($this,
'copy_source',(
int) $_REQUEST[
'copy_source']);
207 if($form->checkInput())
209 $_SESSION[
'rolf_search_query'] = $form->getInput(
'title');
214 $form->setValuesByPost();
215 $ilCtrl->redirect($this,
'roleSearch');
225 $ilTabs->clearTargets();
226 $ilTabs->setBackTarget(
227 $this->lng->txt(
'rbac_back_to_overview'),
228 $this->ctrl->getLinkTarget($this,
'roleSearchList')
231 $ilCtrl->setParameter($this,
'copy_source',(
int) $_REQUEST[
'copy_source']);
233 if(strlen(
$_SESSION[
'rolf_search_query']))
237 include_once
'./Services/AccessControl/classes/class.ilRoleTableGUI.php';
240 $table->setRoleTitleFilter(
$_SESSION[
'rolf_search_query']);
242 $table->parse($this->object->getId());
243 return $this->tpl->setContent($table->getHTML());
247 $ilCtrl->redirect($this,
'roleSearch');
258 $ilTabs->clearTargets();
259 $ilTabs->setBackTarget(
260 $this->lng->txt(
'rbac_back_to_overview'),
261 $this->ctrl->getLinkTarget($this,
'roleSearchList')
264 $GLOBALS[
'ilLog']->write(__METHOD__.
': '.$_REQUEST[
'copy_source']);
266 $ilCtrl->setParameter($this,
'copy_source',(
int) $_REQUEST[
'copy_source']);
269 $this->tpl->setContent($form->getHTML());
279 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
281 $form->setTitle($this->lng->txt(
'rbac_copy_behaviour'));
282 $form->setFormAction(
$ilCtrl->getFormAction($this,
'chooseCopyBehaviour'));
285 $ce->setRequired(
true);
289 $ceo =
new ilRadioOption($this->lng->txt(
'change_existing_objects'),1);
290 $ce->addOption($ceo);
292 $cne =
new ilRadioOption($this->lng->txt(
'rbac_not_change_existing_objects'), 0);
293 $ce->addOption($cne);
296 $roles->setValue(implode(
',',(array)
$_POST[
'roles']));
297 $form->addItem($roles);
303 $form->addCommandButton(
'addRolePermissions', $this->lng->txt(
'rbac_copy_role_add_perm'));
304 $form->addCommandButton(
'removeRolePermissions', $this->lng->txt(
'rbac_copy_role_remove_perm'));
305 $form->addCommandButton(
'copyRole', $this->lng->txt(
'rbac_copy_role_copy'));
309 $form->addCommandButton(
'copyRole', $this->lng->txt(
'rbac_copy_role'));
323 $roles = explode(
',',
$_POST[
'roles']);
324 $source = (int) $_REQUEST[
'copy_source'];
327 if($form->checkInput())
329 foreach((array) $roles as $role_id)
331 if($role_id != $source)
333 $this->
doCopyRole($source,$role_id,$form->getInput(
'change_existing'));
338 $ilCtrl->redirect($this,
'view');
350 $roles = explode(
',',
$_POST[
'roles']);
351 $source = (int) $_REQUEST[
'copy_source'];
354 if($form->checkInput())
356 foreach((array) $roles as $role_id)
358 if($role_id != $source)
365 $ilCtrl->redirect($this,
'view');
374 global $rbacadmin, $rbacreview;
376 $rbacadmin->copyRolePermissionUnion(
378 $this->object->getRefId(),
380 $rbacreview->getRoleFolderOfRole(
$target),
382 $rbacreview->getRoleFolderOfRole(
$target)
387 $target_obj = $rbacreview->getRoleFolderOfRole(
$target);
400 $roles = explode(
',',
$_POST[
'roles']);
401 $source = (int) $_REQUEST[
'copy_source'];
404 if($form->checkInput())
406 foreach((array) $roles as $role_id)
408 if($role_id != $source)
415 $ilCtrl->redirect($this,
'view');
424 global $rbacadmin, $rbacreview;
430 $rbacadmin->copyRolePermissionSubtract(
432 $this->object->getRefId(),
434 $rbacreview->getRoleFolderOfRole(
$target)
439 $target_obj = $rbacreview->getRoleFolderOfRole(
$target);
458 global
$tree, $rbacadmin, $rbacreview;
460 $target_obj = $rbacreview->getRoleFolderOfRole(
$target);
463 $rbacadmin->copyRoleTemplatePermissions(
465 $this->object->getRefId(),
470 if(!$change_existing || !$target_obj)
477 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
478 if($rbacreview->isProtected($this->object->getRefId(),$source))
490 $role->changeExistingObjects(
513 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
514 if($rbacreview->isProtected($this->object->getRefId(),$a_source_role))
526 $role->changeExistingObjects(
541 include_once
'./Services/AccessControl/classes/class.ilRoleTableGUI.php';
544 $table->resetOffset();
545 $table->writeFilterToSession();
555 include_once
'./Services/AccessControl/classes/class.ilRoleTableGUI.php';
558 $table->resetOffset();
559 $table->resetFilter();
571 if(!count(
$_POST[
'roles']))
574 $ilCtrl->redirect($this,
'view');
577 $question = $this->lng->txt(
'rbac_role_delete_qst');
579 include_once
'./Services/Utilities/classes/class.ilConfirmationGUI.php';
581 $confirm->setHeaderText($question);
582 $confirm->setFormAction(
$ilCtrl->getFormAction($this));
583 $confirm->setHeaderText($this->lng->txt(
"info_delete_sure"));
584 $confirm->setConfirm($this->lng->txt(
'delete'),
'deleteRole');
585 $confirm->setCancel($this->lng->txt(
'cancel'),
'cancel');
588 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
589 foreach(
$_POST[
'roles'] as $role_id)
597 $this->tpl->setContent($confirm->getHTML());
607 if(!$rbacsystem->checkAccess(
'delete',$this->object->getRefId()))
610 $this->lng->txt(
'msg_no_perm_delete'),
615 foreach((array)
$_POST[
'roles'] as $id)
620 if ($obj->getType() ==
"role")
622 $rolf_arr = $rbacreview->getFoldersAssignedToRole($obj->getId(),
true);
623 $obj->setParent($rolf_arr[0]);
631 $ilCtrl->redirect($this,
'view');
645 $this->
ilias->raiseError($this->lng->txt(
"permission_denied"),$this->ilias->error_obj->MESSAGE);
662 $this->
ilias->raiseError($this->lng->txt(
"permission_denied"),$this->ilias->error_obj->MESSAGE);
674 $this->ctrl->redirect($this,
"view");
687 $d = $this->objDefinition->getCreatableSubObjects($this->object->getType());
689 if ($this->object->getRefId() != ROLE_FOLDER_ID or !$rbacsystem->checkAccess(
'create_rolt',ROLE_FOLDER_ID))
694 if (!$rbacsystem->checkAccess(
'create_role',$this->object->getRefId()))
707 for ($i=0; $i<count($this->data[
"ctrl"]); $i++)
709 if ($this->data[
"ctrl"][$i][
"type"] ==
$row[
"name"])
715 if (
$row[
"max"] ==
"" || $count <
$row[
"max"])
717 $subobj[] =
$row[
"name"];
722 if (is_array($subobj))
726 $this->tpl->setCurrentBlock(
"add_object");
727 $this->tpl->setVariable(
"SELECT_OBJTYPE", $opts);
728 $this->tpl->setVariable(
"BTN_NAME",
"create");
729 $this->tpl->setVariable(
"TXT_ADD", $this->lng->txt(
"add"));
730 $this->tpl->parseCurrentBlock();
743 $_GET[
"new_type"] = $this->
object->getType();
744 $_POST[
"Fobject"][
"title"] = $this->
object->getTitle();
745 $_POST[
"Fobject"][
"desc"] = $this->
object->getDescription();
748 $newObj = parent::saveObject();
755 $this->ctrl->redirect($this,
"view");
768 $this->tabs_gui->addTarget(
770 $this->ctrl->getLinkTarget($this,
"view"),
775 $this->tabs_gui->addTarget(
777 $this->ctrl->getLinkTarget($this,
"editSettings"),
778 array(
"editSettings"),
785 $this->tabs_gui->addTarget(
"perm_settings",
786 $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'),
800 $this->tpl->setContent($a_form->getHTML());
809 $ilErr->raiseError($this->lng->txt(
'permission_denied'),
$ilErr->MESSAGE);
813 if($form->checkInput())
815 include_once(
'./Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
817 $privacy->enableRbacLog((
int)
$_POST[
'rbac_log']);
818 $privacy->setRbacLogAge((
int)
$_POST[
'rbac_log_age']);
821 if($rbacreview->isAssigned(
$ilUser->getId(),SYSTEM_ROLE_ID))
823 include_once(
'./Services/PrivacySecurity/classes/class.ilSecuritySettings.php');
825 $security->protectedAdminRole((
int)
$_POST[
'admin_role']);
830 $this->ctrl->redirect($this,
"editSettings");
833 $form->setValuesByPost();
841 $this->lng->loadLanguageModule(
'ps');
843 include_once(
'./Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
844 include_once(
'./Services/PrivacySecurity/classes/class.ilSecuritySettings.php');
848 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
850 $form->setFormAction($this->ctrl->getFormAction($this,
"saveSettings"));
851 $form->setTitle($this->lng->txt(
'settings'));
855 $admin->setDisabled(!$rbacreview->isAssigned(
$ilUser->getId(),SYSTEM_ROLE_ID));
856 $admin->setInfo($this->lng->txt(
'adm_adm_role_protect_info'));
857 $admin->setChecked((
int) $security->isAdminRoleProtected());
859 $form->addItem($admin);
861 $check =
new ilCheckboxInputGui($this->lng->txt(
'rbac_log'),
'rbac_log');
862 $check->setInfo($this->lng->txt(
'rbac_log_info'));
863 $check->setChecked($privacy->enabledRbacLog());
864 $form->addItem($check);
866 $age =
new ilNumberInputGUI($this->lng->txt(
'rbac_log_age'),
'rbac_log_age');
867 $age->setInfo($this->lng->txt(
'rbac_log_age_info'));
868 $age->setValue($privacy->getRbacLogAge());
869 $age->setMinValue(1);
870 $age->setMaxValue(24);
872 $age->setMaxLength(2);
873 $check->addSubItem($age);
875 $form->addCommandButton(
'saveSettings',$this->lng->txt(
'save'));
886 include_once(
'./Services/PrivacySecurity/classes/class.ilSecuritySettings.php');
891 return array(array(
"editSettings", $fields));
895 include_once(
'./Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
899 if((
bool)$privacy->enabledRbacLog())
901 $subitems = array(
'rbac_log_age' => $privacy->getRbacLogAge());
905 return array(array(
"editSettings", $fields));
for($col=0; $col< 50; $col++) $d
An exception for terminatinating execution or to throw for unit testing.
Confirmation screen class.
static getLogger($a_component_id)
Get component logger.
Class ilObjRoleFolderGUI.
doRemoveRolePermissions($source, $target, $change_existing)
do add role permission
initCopyBehaviourForm()
Show copy behaviour form.
roleSearchListObject()
List roles.
chooseCopyBehaviourObject()
Chosse change existing objects,...
showPossibleSubObjects()
show possible subobjects (pulldown menu) overwritten to prevent displaying of role templates in local...
copyRoleObject()
Copy role.
adoptPermSaveObject()
??? TODO: what is the purpose of this function? @access public
executeCommand()
execute command
createObject()
role folders are created automatically DEPRECATED !!! @access public
initRoleSearchForm()
Init role search form.
saveObject()
save object @access public
doChangeExistingObjects($a_start_obj, $a_target_role)
Do change existing objects @global type $rbacreview.
__construct($a_data, $a_id, $a_call_by_reference)
Constructor @access public.
roleSearchFormObject()
Parse search query @global type $ilCtrl.
doAddRolePermissions($source, $target, $change_existing)
do add role permission
deleteObject($a_error=false)
display deletion confirmation screen DEPRECATED !!! @access public
resetFilterObject()
Reset role filter.
editSettingsObject(ilPropertyFormGUI $a_form=null)
roleSearchObject()
Search target roles.
doCopyRole($source, $target, $change_existing)
Perform copy of role @global ilTree $tree @global <type> $rbacadmin @global <type> $rbacreview.
addToExternalSettingsForm($a_form_id)
getAdminTabs()
Add role folder tabs @global ilTree $tree @global ilLanguage $lng.
confirmDeleteObject()
Confirm deletion of roles.
removeRolePermissionsObject()
Remove role permissions.
addRolePermissionsObject()
Add role permissions.
deleteRoleObject()
Delete roles.
viewObject()
@global ilErrorHandler $ilErr @global ilRbacSystem $rbacsystem @global ilToolbarGUI $ilToolbar
applyFilterObject()
Apply role filter.
const MODE_PROTECTED_DELETE_LOCAL_POLICIES
const MODE_UNPROTECTED_DELETE_LOCAL_POLICIES
static _getTranslation($a_role_title)
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
Class ilObjectGUI Basic methods of all Output classes.
prepareOutput($a_show_subobjects=true)
prepare output
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission.
static _lookupTitle($a_id)
lookup object title
static _lookupType($a_id, $a_reference=false)
lookup object type
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
static _getInstance()
Get instance of ilPrivacySettings.
This class represents an option in a radio group.
TableGUI for the presentation og roles and role templates.
static _getInstance()
Get instance of ilSecuritySettings.
This class represents a text property in a property form.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static formSelect($selected, $varname, $options, $multiple=false, $direct_text=false, $size="0", $style_class="", $attribs="", $disabled=false)
Builds a select form field with options and shows the selected option first.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
redirection script todo: (a better solution should control the processing via a xml file)