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)
45 $lng->loadLanguageModule(
'rbac');
48 parent::__construct($a_data, $a_id, $a_call_by_reference,
false);
50 $this->ctrl->saveParameter($this,
"obj_id");
59 $next_class = $this->ctrl->getNextClass($this);
60 $cmd = $this->ctrl->getCmd();
62 switch ($next_class) {
83 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
86 if ($this->creation_mode) {
87 $this->ctrl->setParameter($this,
"new_type",
'rolt');
90 $form->setFormAction($this->ctrl->getFormAction($this));
92 if ($a_mode == self::FORM_MODE_CREATE) {
93 $form->setTitle($this->lng->txt(
'rolt_new'));
94 $form->addCommandButton(
'save', $this->lng->txt(
'rolt_new'));
96 $form->setTitle($this->lng->txt(
'rolt_edit'));
97 $form->addCommandButton(
'update', $this->lng->txt(
'save'));
99 $form->addCommandButton(
'cancel', $this->lng->txt(
'cancel'));
102 if ($a_mode != self::FORM_MODE_CREATE) {
103 if ($this->object->isInternalTemplate()) {
104 $title->setDisabled(
true);
106 $title->setValue($this->object->getTitle());
110 $title->setRequired(
true);
115 if ($a_mode != self::FORM_MODE_CREATE) {
116 $desc->setValue($this->object->getDescription());
120 $form->addItem($desc);
122 if ($a_mode != self::FORM_MODE_CREATE) {
124 $ilias_id->setValue(
'il_' . IL_INST_ID .
'_' .
ilObject::_lookupType($this->object->getId()) .
'_' . $this->object->getId());
125 $form->addItem($ilias_id);
128 $pro =
new ilCheckboxInputGUI($this->lng->txt(
'role_protect_permissions'),
'protected');
129 $pro->setChecked(
$GLOBALS[
'rbacreview']->isProtected(
131 $this->object->getId()
134 $form->addItem($pro);
149 if (!
$rbacsystem->checkAccess(
"create_rolt", $this->rolf_ref_id)) {
150 $this->
ilias->raiseError($this->lng->txt(
"permission_denied"), $this->ilias->error_obj->MESSAGE);
155 $this->tpl->setContent(
$form->getHTML());
166 $this->tabs_gui->activateTab(
'settings');
168 if (!
$rbacsystem->checkAccess(
"write", $this->rolf_ref_id)) {
169 $this->
ilias->raiseError($this->lng->txt(
"msg_no_perm_write"), $this->ilias->error_obj->MESSAGE);
188 if (!
$rbacsystem->checkAccess(
"write", $this->rolf_ref_id)) {
189 $this->
ilias->raiseError($this->lng->txt(
"msg_no_perm_modify_rolt"), $this->ilias->error_obj->WARNING);
193 if (
$form->checkInput()) {
194 $this->
object->setTitle(
$form->getInput(
'title'));
195 $this->
object->setDescription(
$form->getInput(
'desc'));
196 $rbacadmin->setProtected(
198 $this->object->getId(),
199 $form->getInput(
'protected') ?
'y' :
'n'
201 $this->
object->update();
203 $this->ctrl->returnToParent($this);
206 $form->setValuesByPost();
221 if (!
$rbacsystem->checkAccess(
"create_rolt", $this->rolf_ref_id)) {
222 $this->
ilias->raiseError($this->lng->txt(
"msg_no_perm_create_rolt"), $this->ilias->error_obj->WARNING);
225 if (
$form->checkInput()) {
226 include_once(
"./Services/AccessControl/classes/class.ilObjRoleTemplate.php");
228 $roltObj->setTitle(
$form->getInput(
'title'));
229 $roltObj->setDescription(
$form->getInput(
'desc'));
231 $rbacadmin->assignRoleToFolder($roltObj->getId(), $this->rolf_ref_id,
'n');
232 $rbacadmin->setProtected(
235 $form->getInput(
'protected') ?
'y' :
'n'
240 $this->ctrl->setParameter($this,
'obj_id', $roltObj->getId());
241 $this->ctrl->redirect($this,
'perm');
243 $form->setValuesByPost();
251 protected function permObject()
270 if (!
$rbacsystem->checkAccess(
'edit_permission', $this->ref_id)) {
271 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_perm'),
$ilErr->MESSAGE);
274 $this->tabs_gui->activateTab(
'perm');
276 $this->tpl->addBlockFile(
279 'tpl.rbac_template_permissions.html',
280 'Services/AccessControl'
283 $this->tpl->setVariable(
'PERM_ACTION', $this->ctrl->getFormAction($this));
285 include_once
'./Services/Accordion/classes/class.ilAccordionGUI.php';
288 $acc->setId(
'template_perm_' . $this->ref_id);
290 $subs =
$objDefinition->getSubObjectsRecursively(
'root',
'true',
false);
293 foreach ($subs as $subtype =>
$def) {
297 $translation = $this->lng->txt(
"obj_" . $subtype);
299 $translation = $this->lng->txt(
'objs_' . $subtype);
302 $sorted[$subtype] =
$def;
303 $sorted[$subtype][
'translation'] = $translation;
307 foreach ($sorted as $subtype =>
$def) {
311 $translation = $this->lng->txt(
"obj_" . $subtype);
313 $translation = $this->lng->txt(
'objs_' . $subtype);
324 $tbl->setShowChangeExistingObjects(
false);
327 $acc->addItem($translation,
$tbl->getHTML());
330 $this->tpl->setVariable(
'ACCORDION', $acc->getHTML());
333 include_once
'./Services/AccessControl/classes/class.ilObjectRoleTemplateOptionsTableGUI.php';
344 $this->lng->txt(
'save')
348 $this->tpl->setVariable(
'OPTIONS_TABLE',
$options->getHTML());
359 protected function permSaveObject()
371 $rbacadmin =
$DIC->rbac()->admin();
385 if (!
$rbacsystem->checkAccess(
'write', $this->rolf_ref_id)) {
386 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_perm'),
$ilErr->MESSAGE);
390 $rbacadmin->deleteRolePermission($this->object->getId(), $this->ref_id);
392 foreach (
$_POST[
"template_perm"] as
$key => $ops_array) {
393 $rbacadmin->setRolePermission($this->object->getId(),
$key, $ops_array, $this->rolf_ref_id);
397 $this->
object->update();
400 $this->ctrl->redirect($this,
"perm");
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");
453 if (
$rbacsystem->checkAccess(
'write', $this->ref_id)) {
454 $this->tabs_gui->addTab(
456 $this->lng->txt(
'settings'),
457 $this->ctrl->getLinkTarget($this,
'edit')
460 if (
$rbacsystem->checkAccess(
'edit_permission', $this->ref_id)) {
461 $this->tabs_gui->addTab(
463 $this->lng->txt(
'default_perm_settings'),
464 $this->ctrl->getLinkTarget($this,
'perm')
475 $this->ctrl->redirectByClass(
"ilobjrolefoldergui",
"view");
487 $ilLocator =
$DIC[
'ilLocator'];
490 $_GET[
"admin_mode"] ==
"settings"
491 &&
$_GET[
"ref_id"] == ROLE_FOLDER_ID) {
492 parent::addAdminLocatorItems(
true);
496 $this->ctrl->getLinkTargetByClass(
"ilobjrolefoldergui",
'view')
499 if (
$_GET[
"obj_id"] > 0) {
501 $this->object->getTitle(),
502 $this->ctrl->getLinkTarget($this,
'perm')
506 parent::addAdminLocatorItems($a_do_not_add_object);
if(!isset( $_REQUEST[ 'ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
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
static lookupTxtById($plugin_id, $lang_var)
Table for object role permissions.
Table for object role permissions.
static _lookupObjId($a_id)
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 sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
redirection script todo: (a better solution should control the processing via a xml file)
if(isset($_POST['submit'])) $form