24 require_once
"./Services/Object/classes/class.ilObjectGUI.php";
56 $this->
ilObjectGUI($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);
107 $this->ctrl->setParameter($this,
'new_type',
'role');
108 $ilToolbar->addButton(
109 $this->lng->txt(
'rolf_create_role'),
110 $this->ctrl->getLinkTarget($this,
'create')
113 $ilToolbar->addButton(
114 $this->lng->txt(
'rbac_import_role'),
115 $this->ctrl->getLinkTargetByClass(
'ilPermissionGUI',
'displayImportRoleForm')
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);
126 include_once
'./Services/AccessControl/classes/class.ilRoleTableGUI.php';
129 $table->parse($this->object->getId());
131 $this->tpl->setContent($table->getHTML());
139 global $rbacsystem,
$ilCtrl, $ilTabs;
141 $ilTabs->clearTargets();
142 $ilTabs->setBackTarget(
143 $this->lng->txt(
'rbac_back_to_overview'),
144 $this->ctrl->getLinkTarget($this,
'view')
147 if(!$rbacsystem->checkAccess(
'visible,read',$this->object->getRefId()))
149 $ilErr->raiseError($this->lng->txt(
'permission_denied'),
$ilErr->MESSAGE);
152 $ilCtrl->setParameter($this,
'copy_source',(
int)
$_REQUEST[
'copy_source']);
156 $this->tpl->setContent($form->getHTML());
166 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
168 $form->setTitle($this->lng->txt(
'rbac_role_title'));
169 $form->setFormAction($ilCtrl->getFormAction($this,
'view'));
173 $search->setSize(30);
174 $search->setMaxLength(255);
175 $form->addItem($search);
177 $form->addCommandButton(
'roleSearchList', $this->lng->txt(
'search'));
188 $ilTabs->clearTargets();
189 $ilTabs->setBackTarget(
190 $this->lng->txt(
'rbac_back_to_overview'),
191 $this->ctrl->getLinkTarget($this,
'roleSearchList')
194 $ilCtrl->setParameter($this,
'copy_source',(
int)
$_REQUEST[
'copy_source']);
197 if($form->checkInput())
201 include_once
'./Services/AccessControl/classes/class.ilRoleTableGUI.php';
204 $table->setRoleTitleFilter($form->getInput(
'title'));
206 $table->parse($this->object->getId());
207 return $this->tpl->setContent($table->getHTML());
211 $form->setValuesByPost();
212 $ilCtrl->redirect($this,
'roleSearch');
223 $ilTabs->clearTargets();
224 $ilTabs->setBackTarget(
225 $this->lng->txt(
'rbac_back_to_overview'),
226 $this->ctrl->getLinkTarget($this,
'roleSearchList')
229 $ilCtrl->setParameter($this,
'copy_source',(
int)
$_REQUEST[
'copy_source']);
232 $this->tpl->setContent($form->getHTML());
242 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
244 $form->setTitle($this->lng->txt(
'rbac_copy_behaviour'));
245 $form->setFormAction($ilCtrl->getFormAction($this,
'chooseCopyBehaviour'));
252 $ceo =
new ilRadioOption($this->lng->txt(
'change_existing_objects'),1);
253 $ce->addOption($ceo);
255 $cne =
new ilRadioOption($this->lng->txt(
'rbac_not_change_existing_objects'), 0);
256 $ce->addOption($cne);
259 $roles->setValue(implode(
',',(array)
$_POST[
'roles']));
260 $form->addItem($roles);
262 $form->addCommandButton(
'copyRole', $this->lng->txt(
'rbac_copy_role'));
274 $roles = explode(
',',
$_POST[
'roles']);
275 $source = (int)
$_REQUEST[
'copy_source'];
278 if($form->checkInput())
280 foreach((array) $roles as $role_id)
282 if($role_id != $source)
284 $this->
doCopyRole($source,$role_id,$form->getInput(
'change_existing'));
289 $ilCtrl->redirect($this,
'view');
303 protected function doCopyRole($source, $target, $change_existing)
305 global
$tree, $rbacadmin, $rbacreview;
307 $srolf = $rbacreview->getRoleFolderOfRole($source);
308 $trolf = $rbacreview->getRoleFolderOfRole($target);
311 $rbacadmin->copyRoleTemplatePermissions(
318 if(!$change_existing)
323 $start = (($trolf == ROLE_FOLDER_ID) ?
325 $tree->getParentId($trolf));
327 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
328 if($rbacreview->isProtected($this->object->getRefId(),$source))
340 $role->changeExistingObjects(
353 include_once
'./Services/AccessControl/classes/class.ilRoleTableGUI.php';
356 $table->resetOffset();
357 $table->writeFilterToSession();
367 include_once
'./Services/AccessControl/classes/class.ilRoleTableGUI.php';
370 $table->resetOffset();
371 $table->resetFilter();
383 if(!count(
$_POST[
'roles']))
386 $ilCtrl->redirect($this,
'view');
389 $question = $this->lng->txt(
'rbac_role_delete_qst');
391 include_once
'./Services/Utilities/classes/class.ilConfirmationGUI.php';
393 $confirm->setHeaderText($question);
394 $confirm->setFormAction($ilCtrl->getFormAction($this));
395 $confirm->setHeaderText($this->lng->txt(
"info_delete_sure"));
396 $confirm->setConfirm($this->lng->txt(
'delete'),
'deleteRole');
397 $confirm->setCancel($this->lng->txt(
'cancel'),
'cancel');
400 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
401 foreach(
$_POST[
'roles'] as $role_id)
409 $this->tpl->setContent($confirm->getHTML());
419 if(!$rbacsystem->checkAccess(
'delete',$this->object->getRefId()))
422 $this->lng->txt(
'msg_no_perm_delete'),
427 foreach((array)
$_POST[
'roles'] as $id)
432 if ($obj->getType() ==
"role")
434 $rolf_arr = $rbacreview->getFoldersAssignedToRole($obj->getId(),
true);
435 $obj->setParent($rolf_arr[0]);
443 $ilCtrl->redirect($this,
'view');
457 $this->ilias->raiseError($this->lng->txt(
"permission_denied"),$this->ilias->error_obj->MESSAGE);
474 $this->ilias->raiseError($this->lng->txt(
"permission_denied"),$this->ilias->error_obj->MESSAGE);
486 $this->ctrl->redirect($this,
"view");
499 $d = $this->objDefinition->getCreatableSubObjects($this->object->getType());
501 if ($this->object->getRefId() != ROLE_FOLDER_ID or !$rbacsystem->checkAccess(
'create_rolt',ROLE_FOLDER_ID))
506 if (!$rbacsystem->checkAccess(
'create_role',$this->object->getRefId()))
519 for ($i=0; $i<count($this->data[
"ctrl"]); $i++)
521 if ($this->data[
"ctrl"][$i][
"type"] == $row[
"name"])
527 if ($row[
"max"] ==
"" || $count < $row[
"max"])
529 $subobj[] = $row[
"name"];
534 if (is_array($subobj))
538 $a_tpl->setCurrentBlock(
"add_object");
539 $a_tpl->setVariable(
"SELECT_OBJTYPE", $opts);
540 $a_tpl->setVariable(
"BTN_NAME",
"create");
541 $a_tpl->setVariable(
"TXT_ADD", $this->lng->txt(
"add"));
542 $a_tpl->parseCurrentBlock();
557 $_GET[
"new_type"] = $this->
object->getType();
558 $_POST[
"Fobject"][
"title"] = $this->
object->getTitle();
559 $_POST[
"Fobject"][
"desc"] = $this->
object->getDescription();
569 $this->ctrl->redirect($this,
"view");
584 $tabs_gui->addTarget(
586 $this->ctrl->getLinkTarget($this,
"view"),
595 $tabs_gui->addTarget(
"perm_settings",
596 $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'),