5require_once
"./Services/Object/classes/class.ilObjectGUI.php";
6require_once(
'./Services/Repository/classes/class.ilObjectPlugin.php');
41 public function __construct($a_data, $a_id, $a_call_by_reference)
47 $lng->loadLanguageModule(
'rbac');
50 parent::__construct($a_data, $a_id, $a_call_by_reference,
false);
52 $this->ctrl->saveParameter($this,
"obj_id");
59 $rbacsystem =
$DIC[
'rbacsystem'];
63 $next_class = $this->ctrl->getNextClass($this);
64 $cmd = $this->ctrl->getCmd();
66 switch ($next_class) {
87 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
90 if ($this->creation_mode) {
91 $this->ctrl->setParameter($this,
"new_type",
'rolt');
94 $form->setFormAction($this->ctrl->getFormAction($this));
96 if ($a_mode == self::FORM_MODE_CREATE) {
97 $form->setTitle($this->lng->txt(
'rolt_new'));
98 $form->addCommandButton(
'save', $this->lng->txt(
'rolt_new'));
100 $form->setTitle($this->lng->txt(
'rolt_edit'));
101 $form->addCommandButton(
'update', $this->lng->txt(
'save'));
103 $form->addCommandButton(
'cancel', $this->lng->txt(
'cancel'));
106 if ($a_mode != self::FORM_MODE_CREATE) {
107 if ($this->object->isInternalTemplate()) {
108 $title->setDisabled(
true);
110 $title->setValue($this->object->getTitle());
114 $title->setRequired(
true);
119 if ($a_mode != self::FORM_MODE_CREATE) {
120 $desc->setValue($this->object->getDescription());
124 $form->addItem($desc);
126 if ($a_mode != self::FORM_MODE_CREATE) {
128 $ilias_id->setValue(
'il_' . IL_INST_ID .
'_' .
ilObject::_lookupType($this->object->getId()) .
'_' . $this->object->getId());
129 $form->addItem($ilias_id);
132 $pro =
new ilCheckboxInputGUI($this->lng->txt(
'role_protect_permissions'),
'protected');
133 $pro->setChecked(
$GLOBALS[
'DIC'][
'rbacreview']->isProtected(
135 $this->object->getId()
138 $form->addItem($pro);
153 $rbacsystem =
$DIC[
'rbacsystem'];
155 if (!$rbacsystem->checkAccess(
"create_rolt", $this->rolf_ref_id)) {
156 $this->
ilias->raiseError($this->lng->txt(
"permission_denied"), $this->ilias->error_obj->MESSAGE);
161 $this->tpl->setContent(
$form->getHTML());
172 $rbacsystem =
$DIC[
'rbacsystem'];
174 $this->tabs_gui->activateTab(
'settings');
176 if (!$rbacsystem->checkAccess(
"write", $this->rolf_ref_id)) {
177 $this->
ilias->raiseError($this->lng->txt(
"msg_no_perm_write"), $this->ilias->error_obj->MESSAGE);
195 $rbacsystem =
$DIC[
'rbacsystem'];
196 $rbacadmin =
$DIC[
'rbacadmin'];
200 if (!$rbacsystem->checkAccess(
"write", $this->rolf_ref_id)) {
201 $this->
ilias->raiseError($this->lng->txt(
"msg_no_perm_modify_rolt"), $this->ilias->error_obj->WARNING);
205 if (
$form->checkInput()) {
206 $this->
object->setTitle(
$form->getInput(
'title'));
207 $this->
object->setDescription(
$form->getInput(
'desc'));
208 $rbacadmin->setProtected(
210 $this->object->getId(),
211 $form->getInput(
'protected') ?
'y' :
'n'
213 $this->
object->update();
214 ilUtil::sendSuccess($this->lng->txt(
"saved_successfully"),
true);
215 $this->ctrl->returnToParent($this);
218 $form->setValuesByPost();
233 $rbacsystem =
$DIC[
'rbacsystem'];
234 $rbacadmin =
$DIC[
'rbacadmin'];
237 if (!$rbacsystem->checkAccess(
"create_rolt", $this->rolf_ref_id)) {
238 $this->
ilias->raiseError($this->lng->txt(
"msg_no_perm_create_rolt"), $this->ilias->error_obj->WARNING);
241 if (
$form->checkInput()) {
242 include_once(
"./Services/AccessControl/classes/class.ilObjRoleTemplate.php");
244 $roltObj->setTitle(
$form->getInput(
'title'));
245 $roltObj->setDescription(
$form->getInput(
'desc'));
247 $rbacadmin->assignRoleToFolder($roltObj->getId(), $this->rolf_ref_id,
'n');
248 $rbacadmin->setProtected(
251 $form->getInput(
'protected') ?
'y' :
'n'
254 ilUtil::sendSuccess($this->lng->txt(
"rolt_added"),
true);
256 $this->ctrl->setParameter($this,
'obj_id', $roltObj->getId());
257 $this->ctrl->redirect($this,
'perm');
259 $form->setValuesByPost();
267 protected function permObject()
274 $rbacsystem =
$DIC->rbac()->system();
286 if (!$rbacsystem->checkAccess(
'edit_permission', $this->ref_id)) {
287 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_perm'),
$ilErr->MESSAGE);
290 $this->tabs_gui->activateTab(
'perm');
292 $this->tpl->addBlockFile(
295 'tpl.rbac_template_permissions.html',
296 'Services/AccessControl'
299 $this->tpl->setVariable(
'PERM_ACTION', $this->ctrl->getFormAction($this));
301 include_once
'./Services/Accordion/classes/class.ilAccordionGUI.php';
304 $acc->setId(
'template_perm_' . $this->ref_id);
306 $subs = ilObjRole::getSubObjects(
'root',
false);
308 foreach ($subs as $subtype =>
$def) {
317 $tbl->setShowChangeExistingObjects(
false);
320 $acc->addItem(
$def[
'translation'],
$tbl->getHTML());
323 $this->tpl->setVariable(
'ACCORDION', $acc->getHTML());
326 include_once
'./Services/AccessControl/classes/class.ilObjectRoleTemplateOptionsTableGUI.php';
337 $this->lng->txt(
'save')
341 $this->tpl->setVariable(
'OPTIONS_TABLE',
$options->getHTML());
350 protected function permSaveObject()
357 $rbacsystem =
$DIC->rbac()->system();
362 $rbacadmin =
$DIC->rbac()->admin();
375 if (!$rbacsystem->checkAccess(
'write', $this->rolf_ref_id)) {
376 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_perm'),
$ilErr->MESSAGE);
381 $subs = ilObjRole::getSubObjects(
'root',
false);
383 foreach ($subs as $subtype =>
$def) {
385 $rbacadmin->deleteRolePermission($this->object->getId(), $this->ref_id, $subtype);
388 foreach (
$_POST[
"template_perm"] as
$key => $ops_array) {
389 $rbacadmin->setRolePermission($this->object->getId(),
$key, $ops_array, $this->rolf_ref_id);
393 $this->
object->update();
395 ilUtil::sendSuccess($this->lng->txt(
"saved_successfully"),
true);
396 $this->ctrl->redirect($this,
"perm");
408 $rbacadmin =
$DIC[
'rbacadmin'];
409 $rbacsystem =
$DIC[
'rbacsystem'];
412 if (!$rbacsystem->checkAccess(
'write', $this->rolf_ref_id)) {
413 $this->
ilias->raiseError($this->lng->txt(
"msg_no_perm_perm"), $this->ilias->error_obj->WARNING);
414 } elseif ($this->obj_id ==
$_POST[
"adopt"]) {
417 $rbacadmin->deleteRolePermission($this->obj_id, $this->rolf_ref_id);
418 $parentRoles =
$rbacreview->getParentRoleIds($this->rolf_ref_id,
true);
419 $rbacadmin->copyRoleTemplatePermissions(
421 $parentRoles[
$_POST[
"adopt"]][
"parent"],
426 $this->
object->update();
429 $obj_data = &$this->
ilias->obj_factory->getInstanceByObjId($_POST[
"adopt"]);
430 ilUtil::sendSuccess($this->lng->txt(
"msg_perm_adopted_from1") .
" '" . $obj_data->getTitle() .
"'.<br/>" . $this->lng->txt(
"msg_perm_adopted_from2"),
true);
433 $this->ctrl->redirect($this,
"perm");
451 $rbacsystem =
$DIC->rbac()->system();
452 $this->tabs_gui->setBackTarget($this->lng->txt(
'btn_back'), $this->ctrl->getParentReturn($this));
454 if ($rbacsystem->checkAccess(
'write', $this->ref_id)) {
455 $this->tabs_gui->addTab(
457 $this->lng->txt(
'settings'),
458 $this->ctrl->getLinkTarget($this,
'edit')
461 if ($rbacsystem->checkAccess(
'edit_permission', $this->ref_id)) {
462 $this->tabs_gui->addTab(
464 $this->lng->txt(
'default_perm_settings'),
465 $this->ctrl->getLinkTarget($this,
'perm')
476 $this->ctrl->redirectByClass(
"ilobjrolefoldergui",
"view");
488 $ilLocator =
$DIC[
'ilLocator'];
490 parent::addAdminLocatorItems(
true);
496 $this->ctrl->getLinkTargetByClass(
"ilobjrolefoldergui",
"view")
An exception for terminatinating execution or to throw for unit testing.
Accordion user interface class.
This class represents a non editable value in a property form.
Class ilObjRoleTemplateGUI.
createObject(ilPropertyFormGUI $form=null)
create new role definition template
adoptPermSaveObject()
adopting permission setting from other roles/role templates
cancelObject()
cancelObject is called when an operation is canceled, method links back @access public
getAdminTabs()
admin and normal tabs are equal for roles
__construct($a_data, $a_id, $a_call_by_reference)
Constructor.
executeCommand()
execute command
addAdminLocatorItems($a_do_not_add_object=false)
should be overwritten to add object specific items (repository items are preloaded)
saveObject()
save a new role template object
updateObject()
update role template object
editObject(ilPropertyFormGUI $form=null)
Create new object.
getTabs()
get tabs abstract method.@abstract overwrite in derived GUI class of your object type @access public
initFormRoleTemplate($a_mode=self::FORM_MODE_CREATE)
Init create form.
Class ilObjectGUI Basic methods of all Output classes.
prepareOutput($a_show_subobjects=true)
prepare output
createObject()
create new object form
Table for object role permissions.
Table for object role permissions.
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title
static _lookupType($a_id, $a_reference=false)
lookup object type
This class represents a text area property in a property form.
This class represents a text property in a property form.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
redirection script todo: (a better solution should control the processing via a xml file)
if(isset($_POST['submit'])) $form