5require_once 
"./Services/Object/classes/class.ilObjectGUI.php";
 
    6require_once(
'./Services/Repository/classes/class.ilObjectPlugin.php');
 
   46                $lng->loadLanguageModule(
'rbac');
 
   49                parent::__construct($a_data,$a_id,$a_call_by_reference,
false);
 
   51                $this->ctrl->saveParameter($this, 
"obj_id");
 
   60                $next_class = $this->ctrl->getNextClass($this);
 
   61                $cmd = $this->ctrl->getCmd();
 
   86                include_once 
'./Services/Form/classes/class.ilPropertyFormGUI.php';
 
   89                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)
 
   98                        $form->setTitle($this->lng->txt(
'rolt_new'));
 
   99                        $form->addCommandButton(
'save', $this->lng->txt(
'rolt_new'));
 
  103                        $form->setTitle($this->lng->txt(
'rolt_edit'));
 
  104                        $form->addCommandButton(
'update', $this->lng->txt(
'save'));
 
  107                $form->addCommandButton(
'cancel', $this->lng->txt(
'cancel'));
 
  110                if($a_mode != self::FORM_MODE_CREATE)
 
  112                        if($this->object->isInternalTemplate())
 
  114                                $title->setDisabled(
true);
 
  116                        $title->setValue($this->object->getTitle());
 
  120                $title->setRequired(
true);
 
  125                if($a_mode != self::FORM_MODE_CREATE)
 
  127                        $desc->setValue($this->object->getDescription());
 
  131                $form->addItem($desc);
 
  133                if($a_mode != self::FORM_MODE_CREATE)
 
  136                        $ilias_id->setValue(
'il_'.IL_INST_ID.
'_'.
ilObject::_lookupType($this->object->getId()).
'_'.$this->object->getId());
 
  137                        $form->addItem($ilias_id);
 
  140                $pro = 
new ilCheckboxInputGUI($this->lng->txt(
'role_protect_permissions'),
'protected');
 
  141                $pro->setChecked(
$GLOBALS[
'rbacreview']->isProtected(
 
  143                                $this->object->getId()
 
  146                $form->addItem($pro);
 
  161                if (!$rbacsystem->checkAccess(
"create_rolt", $this->rolf_ref_id))
 
  163                        $this->
ilias->raiseError($this->lng->txt(
"permission_denied"),$this->ilias->error_obj->MESSAGE);
 
  169                $this->tpl->setContent($form->getHTML());
 
  180                if (!$rbacsystem->checkAccess(
"write", $this->rolf_ref_id))
 
  182                        $this->
ilias->raiseError($this->lng->txt(
"msg_no_perm_write"),$this->ilias->error_obj->MESSAGE);
 
  189                $GLOBALS[
'tpl']->setContent($form->getHTML());
 
  199                global $rbacsystem, $rbacadmin, $rbacreview;
 
  202                if (!$rbacsystem->checkAccess(
"write", $this->rolf_ref_id))
 
  204                        $this->
ilias->raiseError($this->lng->txt(
"msg_no_perm_modify_rolt"),$this->ilias->error_obj->WARNING);
 
  208                if($form->checkInput())
 
  210                        $this->
object->setTitle($form->getInput(
'title'));
 
  211                        $this->
object->setDescription($form->getInput(
'desc'));
 
  212                        $rbacadmin->setProtected(
 
  214                                        $this->object->getId(),
 
  215                                        $form->getInput(
'protected') ? 
'y' : 
'n' 
  217                        $this->
object->update();
 
  219                        $this->ctrl->returnToParent($this);
 
  222                $form->setValuesByPost();
 
  235                global $rbacsystem,$rbacadmin, $rbacreview;
 
  237                if (!$rbacsystem->checkAccess(
"create_rolt",$this->rolf_ref_id))
 
  239                        $this->
ilias->raiseError($this->lng->txt(
"msg_no_perm_create_rolt"),$this->ilias->error_obj->WARNING);
 
  242                if($form->checkInput())
 
  244                        include_once(
"./Services/AccessControl/classes/class.ilObjRoleTemplate.php");
 
  246                        $roltObj->setTitle($form->getInput(
'title'));
 
  247                        $roltObj->setDescription($form->getInput(
'desc'));
 
  249                        $rbacadmin->assignRoleToFolder($roltObj->getId(), $this->rolf_ref_id,
'n');
 
  250                        $rbacadmin->setProtected(
 
  253                                        $form->getInput(
'protected') ? 
'y' : 
'n' 
  258                        $this->ctrl->setParameter($this,
'obj_id',$roltObj->getId());
 
  259                        $this->ctrl->redirect($this,
'perm');
 
  261                $form->setValuesByPost();
 
  274                if (!$rbacsystem->checkAccess(
'write',$this->rolf_ref_id))
 
  276                        $this->
ilias->raiseError($this->lng->txt(
"msg_no_perm_perm"),$this->ilias->error_obj->WARNING);
 
  282                $tpl_filter = array();
 
  283                $internal_tpl = 
false;
 
  285                if (($internal_tpl = $this->object->isInternalTemplate()))
 
  287                        $tpl_filter = $this->
object->getFilterOfInternalTemplate();
 
  293                        $op_order[$op[
"ops_id"]] = $op[
"order"];
 
  296                $operation_info = $rbacreview->getOperationAssignment();
 
  298                foreach($operation_info as 
$info)
 
  305                        if(in_array(
$info[
'type'],$to_filter))
 
  309                        if ($internal_tpl and $tpl_filter and !in_array(
$info[
'type'],$tpl_filter))
 
  313                        $rbac_objects[
$info[
'typ_id']] = array(
"obj_id" => 
$info[
'typ_id'],
 
  314                                                                                            "type"              => 
$info[
'type']);
 
  318                                : $this->lng->txt(
$info[
'type'].
"_".
$info[
'operation']);
 
  319                        if (substr(
$info[
'operation'], 0, 7) == 
"create_" &&
 
  324                        elseif(substr(
$info[
'operation'],0,6) == 
'create')
 
  326                                $txt = $this->lng->txt(
'rbac_'.
$info[
'operation']);
 
  329                        $order = $op_order[
$info[
'ops_id']];
 
  330                        if(substr(
$info[
'operation'],0,6) == 
'create')
 
  335                        $rbac_operations[
$info[
'typ_id']][
$info[
'ops_id']] = array(
 
  336                                                                                                                                "ops_id"        => 
$info[
'ops_id'],
 
  337                                                                                                                                "title"         => 
$info[
'operation'],
 
  342                foreach ($rbac_objects as $key => $obj_data)
 
  347                                                "obj_".$obj_data[
"type"]);
 
  351                                $rbac_objects[$key][
"name"] = $this->lng->txt(
"obj_".$obj_data[
"type"]);
 
  354                        $rbac_objects[$key][
"ops"] = $rbac_operations[$key];
 
  359                foreach ($rbac_objects as $key => $obj_data)
 
  361                        sort($rbac_objects[$key][
"ops"]);
 
  368                foreach ($rbac_objects as $key => $obj_data)
 
  370                        $arr_selected = $rbacreview->getOperationsOfRole($this->object->getId(), $obj_data[
"type"], $this->rolf_ref_id);
 
  371                        $arr_checked = array_intersect($arr_selected,array_keys($rbac_operations[$obj_data[
"obj_id"]]));
 
  373                        foreach ($rbac_operations[$obj_data[
"obj_id"]] as $operation)
 
  375                                $checked = in_array($operation[
"ops_id"],$arr_checked);
 
  379                                $box = ilUtil::formCheckBox($checked,
"template_perm[".$obj_data[
"type"].
"][]",$operation[
"ops_id"],$disabled);
 
  380                                $output[
"perm"][$obj_data[
"obj_id"]][$operation[
"ops_id"]] = $box;
 
  385                $output[
"col_anz"] = count($rbac_objects);
 
  386                $output[
"txt_save"] = $this->lng->txt(
"save");
 
  387                $output[
"check_protected"] = ilUtil::formCheckBox($rbacreview->isProtected($this->rolf_ref_id,$this->object->getId()),
"protected",1);
 
  388                $output[
"text_protected"] = $this->lng->txt(
"role_protect_permissions");
 
  394                $output[
"message_middle"] = $this->lng->txt(
"adopt_perm_from_template");
 
  397                if ($this->object->getId() == SYSTEM_ROLE_ID)
 
  405                        $parent_role_ids = $rbacreview->getParentRoleIds($this->rolf_ref_id,
true);
 
  408                        ksort($parent_role_ids);
 
  410                        foreach ($parent_role_ids as $key => $par)
 
  412                                if ($par[
"obj_id"] != SYSTEM_ROLE_ID)
 
  416                                        $output[
"adopt"][$key][
"check_adopt"] = $radio;
 
  417                                        $output[
"adopt"][$key][
"type"] = ($par[
"type"] == 
'role' ? 
'Role' : 
'Template');
 
  418                                        $output[
"adopt"][$key][
"role_name"] = $par[
"title"];
 
  422                        $output[
"formaction_adopt"] = $this->ctrl->getFormAction($this);
 
  427                        $this->ctrl->getFormAction($this);
 
  436                $this->tpl->addBlockFile(
"ADM_CONTENT", 
"adm_content", 
"tpl.adm_perm_role.html",
 
  437                        "Services/AccessControl");
 
  439                foreach ($rbac_objects as $obj_data)
 
  442                        $this->tpl->setCurrentBlock(
"object_operations");
 
  446                        foreach ($obj_data[
"ops"] as $operation)
 
  448                                $ops_ids[] = $operation[
"ops_id"];
 
  451                                $this->tpl->setVariable(
"CSS_ROW",$css_row);
 
  452                                $this->tpl->setVariable(
"PERMISSION",$operation[
"name"]);
 
  453                                $this->tpl->setVariable(
"CHECK_PERMISSION",$this->data[
"perm"][$obj_data[
"obj_id"]][$operation[
"ops_id"]]);
 
  454                                $this->tpl->parseCurrentBlock();
 
  458                        $this->tpl->setCurrentBlock(
"object_type");
 
  459                        $this->tpl->setVariable(
"TXT_OBJ_TYPE",$obj_data[
"name"]);
 
  462                        if ($this->objDefinition->getDevMode($obj_data[
"type"]))
 
  464                                $this->tpl->setVariable(
"TXT_NOT_IMPL", 
"(".$this->lng->txt(
"not_implemented_yet").
")");
 
  468                        $this->tpl->setVariable(
"JS_VARNAME",
"template_perm_".$obj_data[
"type"]);
 
  470                        $this->tpl->setVariable(
"TXT_CHECKALL", $this->lng->txt(
"check_all"));
 
  471                        $this->tpl->setVariable(
"TXT_UNCHECKALL", $this->lng->txt(
"uncheck_all"));      
 
  474                        $this->tpl->parseCurrentBlock();
 
  498                $this->tpl->setCurrentBlock(
"tblfooter_protected");
 
  499                $this->tpl->setVariable(
"COL_ANZ",3);
 
  500                $this->tpl->setVariable(
"CHECK_BOTTOM",$this->data[
"check_protected"]);
 
  501                $this->tpl->setVariable(
"MESSAGE_TABLE",$this->data[
"text_protected"]);
 
  502                $this->tpl->parseCurrentBlock();
 
  504                $this->tpl->setVariable(
"COL_ANZ_PLUS",4);
 
  505                $this->tpl->setVariable(
"TXT_SAVE",$this->data[
"txt_save"]);
 
  506                $this->tpl->setCurrentBlock(
"adm_content");
 
  507                $this->tpl->setVariable(
"TBL_TITLE_IMG",
ilUtil::getImagePath(
"icon_".$this->object->getType().
".svg"));
 
  508                $this->tpl->setVariable(
"TBL_TITLE_IMG_ALT",$this->lng->txt($this->object->getType()));
 
  511                if (substr($this->object->getTitle(),0,3) == 
"il_")
 
  513                        $desc = $this->lng->txt(
"predefined_template");
 
  516                $description = 
"<br/> <span class=\"small\">".$desc.
"</span>";
 
  519                if (substr($this->object->getTitle(),0,3) == 
"il_")
 
  521                        include_once(
'./Services/AccessControl/classes/class.ilObjRole.php');
 
  527                        $title = $this->
object->getTitle();
 
  530                $this->tpl->setVariable(
"TBL_TITLE",
$title.$description);
 
  532                $this->tpl->setVariable(
"TXT_PERMISSION",$this->data[
"txt_permission"]);
 
  533                $this->tpl->setVariable(
"FORMACTION",$this->data[
"formaction"]);
 
  534                $this->tpl->parseCurrentBlock();
 
  547                if (!$rbacsystem->checkAccess(
'write',$this->rolf_ref_id))
 
  549                        $this->
ilias->raiseError($this->lng->txt(
"msg_no_perm_perm"),$this->ilias->error_obj->WARNING);
 
  554                        $rbacadmin->deleteRolePermission($this->object->getId(), $this->rolf_ref_id);
 
  556                        foreach (
$_POST[
"template_perm"] as $key => $ops_array)
 
  559                                $rbacadmin->setRolePermission($this->object->getId(), $key,$ops_array,$this->rolf_ref_id);
 
  564                $this->
object->update();
 
  568                #$rbacadmin->setProtected($this->rolf_ref_id,$this->object->getId(),ilUtil::tf2yn($_POST['protected'])); 
  572                $this->ctrl->redirect($this, 
"perm");
 
  582                global $rbacadmin, $rbacsystem, $rbacreview;
 
  584                if (!$rbacsystem->checkAccess(
'write',$this->rolf_ref_id))
 
  586                        $this->
ilias->raiseError($this->lng->txt(
"msg_no_perm_perm"),$this->ilias->error_obj->WARNING);
 
  588                elseif ($this->obj_id == 
$_POST[
"adopt"])
 
  594                        $rbacadmin->deleteRolePermission($this->obj_id, $this->rolf_ref_id);
 
  595                        $parentRoles = $rbacreview->getParentRoleIds($this->rolf_ref_id,
true);
 
  596                        $rbacadmin->copyRoleTemplatePermissions(
$_POST[
"adopt"],$parentRoles[
$_POST[
"adopt"]][
"parent"],
 
  597                                                                                   $this->rolf_ref_id,$this->obj_id);           
 
  599                        $this->
object->update();
 
  602                        $obj_data =& $this->
ilias->obj_factory->getInstanceByObjId($_POST[
"adopt"]);
 
  603                        ilUtil::sendSuccess($this->lng->txt(
"msg_perm_adopted_from1").
" '".$obj_data->getTitle().
"'.<br/>".$this->lng->txt(
"msg_perm_adopted_from2"),
true);
 
  606                $this->ctrl->redirect($this, 
"perm");
 
  621                if ($rbacsystem->checkAccess(
'write',$this->rolf_ref_id))
 
  623                        $this->tabs_gui->addTarget(
"settings",
 
  624                                $this->ctrl->getLinkTarget($this, 
"edit"),
 
  625                                array(
"edit",
"update"), get_class($this));
 
  627                        $this->tabs_gui->addTarget(
"default_perm_settings",
 
  628                                $this->ctrl->getLinkTarget($this, 
"perm"),
 
  629                                array(
"perm"), get_class($this));
 
  640                $this->ctrl->redirectByClass(
"ilobjrolefoldergui",
"view");
 
  654                parent::addAdminLocatorItems(
true);
 
  658                        $this->ctrl->getLinkTargetByClass(
"ilobjrolefoldergui", 
"view"));
 
An exception for terminatinating execution or to throw for unit testing.
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.
permObject()
display permissions
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
permSaveObject()
save permission templates of role
updateObject()
update role template object
editObject(ilPropertyFormGUI $form=null)
Create new object.
getTabs()
get tabs abstract method.
initFormRoleTemplate($a_mode=self::FORM_MODE_CREATE)
Init create form.
static _getTranslation($a_role_title)
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)
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title
static _lookupType($a_id, $a_reference=false)
lookup object type
static _getOperationList($a_type=null)
get operation list by object type @access public @access static
This class represents a text area property in a property form.
This class represents a text property in a property form.
static formRadioButton($checked, $varname, $value, $onclick=null, $disabled=false)
??? @access public
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.
static switchColor($a_num, $a_css1, $a_css2)
switches style sheets for each even $a_num (used for changing colors of different result rows)
static array_php2js($data)
convert php arrays to javascript arrays
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\s+" &#(? foreach( $entity_files as $file) $output
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
redirection script todo: (a better solution should control the processing via a xml file)