3 declare(strict_types=1);
    47         $this->objDefinition = $DIC[
'objDefinition'];
    48         $this->review = $DIC->rbac()->review();
    50         $this->ref_id = $a_ref_id;
    51         $this->
setId(
'objroleperm_' . $this->ref_id);
    54         $this->
lng->loadLanguageModule(
'rbac');
    56         $this->tree = $DIC->repositoryTree();
    57         $this->tree_path_ids = $this->tree->getPathId($this->ref_id);
    59         $tpl = $DIC->ui()->mainTemplate();
    60         $tpl->addJavaScript(
'./Services/AccessControl/js/ilPermSelect.js');
    62         $this->
setTitle($this->
lng->txt(
'permission_settings'));
    67         $this->
setRowTemplate(
"tpl.obj_role_perm_row.html", 
"Services/AccessControl");
   113         $this->activeOperations[] = $a_ops_id;
   127         $this->visible_roles = $a_ar;
   145         $tree = $DIC[
'tree'];
   153         if (!$roles->getValue()) {
   155                 $roles->setValue(self::ROLE_FILTER_LOCAL);
   157                 $roles->setValue(self::ROLE_FILTER_ALL);
   163                 self::ROLE_FILTER_ALL => $this->
lng->txt(
'filter_all_roles'),
   164                 self::ROLE_FILTER_GLOBAL => $this->
lng->txt(
'filter_global_roles'),
   165                 self::ROLE_FILTER_LOCAL => $this->
lng->txt(
'filter_local_roles'),
   166                 self::ROLE_FILTER_LOCAL_POLICY => $this->
lng->txt(
'filter_roles_local_policy'),
   167                 self::ROLE_FILTER_LOCAL_OBJECT => $this->
lng->txt(
'filter_local_roles_object')
   174     protected function fillRow(array $a_set): void
   177         if (isset($a_set[
'show_local_policy_row'])) {
   178             foreach ($a_set[
'roles'] as $role_id => $role_info) {
   179                 $this->tpl->setCurrentBlock(
'role_option');
   180                 $this->tpl->setVariable(
'INHERIT_ROLE_ID', $role_id);
   181                 $this->tpl->setVariable(
'INHERIT_CHECKED', $role_info[
'local_policy'] ? 
'checked=checked' : 
'');
   182                 $this->tpl->setVariable(
   184                     ($role_info[
'protected'] || $role_info[
'isLocal'] || $role_info[
'blocked']) ? 
'disabled="disabled"' : 
''   186                 $this->tpl->setVariable(
'TXT_INHERIT', $this->
lng->txt(
'rbac_local_policy'));
   187                 $this->tpl->setVariable(
'INHERIT_LONG', $this->
lng->txt(
'perm_use_local_policy_desc'));
   188                 $this->tpl->parseCurrentBlock();
   193         if (isset($a_set[
'show_protected_row'])) {
   194             foreach ($a_set[
'roles'] as $role_id => $role_info) {
   195                 $this->tpl->setCurrentBlock(
'role_protect');
   196                 $this->tpl->setVariable(
'PROTECT_ROLE_ID', $role_id);
   197                 $this->tpl->setVariable(
'PROTECT_CHECKED', $role_info[
'protected_status'] ? 
'checked=checked' : 
'');
   198                 $this->tpl->setVariable(
   200                     $role_info[
'protected_allowed'] ? 
'' : 
'disabled="disabled"'   202                 $this->tpl->setVariable(
'TXT_PROTECT', $this->
lng->txt(
'role_protect_permissions'));
   203                 $this->tpl->setVariable(
'PROTECT_LONG', $this->
lng->txt(
'role_protect_permissions_desc'));
   204                 $this->tpl->parseCurrentBlock();
   210         if (isset($a_set[
'show_block_row'])) {
   212                 $this->tpl->setCurrentBlock(
'role_block');
   213                 $this->tpl->setVariable(
'BLOCK_ROLE_ID', $role_info[
'obj_id']);
   214                 $this->tpl->setVariable(
'TXT_BLOCK', $this->
lng->txt(
'role_block_role'));
   215                 $this->tpl->setVariable(
'BLOCK_LONG', $this->
lng->txt(
'role_block_role_desc'));
   216                 if ($role_info[
'blocked']) {
   217                     $this->tpl->setVariable(
'BLOCK_CHECKED', 
'checked="checked"');
   220                     ($role_info[
'protected'] == 
'y') ||
   221                     ($role_info[
'assign'] == 
'y' && $role_info[
'parent'] == $this->
getRefId())
   223                     $this->tpl->setVariable(
'BLOCK_DISABLED', 
'disabled="disabled');
   226                 $this->tpl->parseCurrentBlock();
   232         if (isset($a_set[
'show_select_all'])) {
   234                 $this->tpl->setCurrentBlock(
'role_select_all');
   235                 $this->tpl->setVariable(
'JS_ROLE_ID', $role[
'obj_id']);
   236                 $this->tpl->setVariable(
'JS_SUBID', $a_set[
'subtype']);
   237                 $this->tpl->setVariable(
'JS_ALL_PERMS', 
"['" . implode(
"','", $a_set[
'ops']) . 
"']");
   238                 $this->tpl->setVariable(
'JS_FORM_NAME', $this->
getFormName());
   239                 $this->tpl->setVariable(
'TXT_SEL_ALL', $this->
lng->txt(
'select_all'));
   240                 $this->tpl->parseCurrentBlock();
   246         if (isset($a_set[
'show_start_info'])) {
   247             $this->tpl->setCurrentBlock(
'section_info');
   248             $this->tpl->setVariable(
'SECTION_TITLE', $this->
lng->txt(
'perm_class_object'));
   249             $this->tpl->setVariable(
'SECTION_DESC', $this->
lng->txt(
'perm_class_object_desc'));
   250             $this->tpl->parseCurrentBlock();
   255         if (isset($a_set[
'show_create_info'])) {
   256             $this->tpl->setCurrentBlock(
'section_info');
   257             $this->tpl->setVariable(
'SECTION_TITLE', $this->
lng->txt(
'perm_class_create'));
   258             $this->tpl->setVariable(
'SECTION_DESC', $this->
lng->txt(
'perm_class_create_desc'));
   259             $this->tpl->parseCurrentBlock();
   264         foreach ((array) $a_set[
'roles'] as $role_id => $role_info) {
   266             $this->tpl->setCurrentBlock(
'role_td');
   267             $this->tpl->setVariable(
'PERM_ROLE_ID', $role_id);
   268             $this->tpl->setVariable(
'PERM_PERM_ID', $a_set[
'perm'][
'ops_id']);
   270             if (substr($a_set[
'perm'][
'operation'], 0, 6) == 
'create') {
   271                 if ($this->objDefinition->isPlugin(substr($a_set[
'perm'][
'operation'], 7))) {
   273                         substr($a_set[
'perm'][
'operation'], 7),
   274                         "obj_" . substr($a_set[
'perm'][
'operation'], 7)
   277                     $perm = $this->
lng->txt(
'obj_' . substr($a_set[
'perm'][
'operation'], 7));
   280                 if ($this->objDefinition->isPlugin($this->getObjType())) {
   287                     if ($this->
lng->exists($this->getObjType() . 
'_' . $a_set[
'perm'][
'operation'] . 
'_short')) {
   288                         $perm = $this->
lng->txt($this->
getObjType() . 
'_' . $a_set[
'perm'][
'operation'] . 
'_short');
   290                         $perm = $this->
lng->txt($a_set[
'perm'][
'operation']);
   295             $this->tpl->setVariable(
'TXT_PERM', $perm);
   297             if ($this->objDefinition->isPlugin($this->getObjType())) {
   300                     $this->
getObjType() . 
"_" . $a_set[
'perm'][
'operation']
   302             } elseif (substr($a_set[
'perm'][
'operation'], 0, 6) == 
'create') {
   303                 if ($this->objDefinition->isPlugin(substr($a_set[
'perm'][
'operation'], 7))) {
   305                         substr($a_set[
'perm'][
'operation'], 7),
   306                         $this->
getObjType() . 
"_" . $a_set[
'perm'][
'operation']
   309                     $this->tpl->setVariable(
'PERM_LONG', $this->
lng->txt(
'rbac_' . $a_set[
'perm'][
'operation']));
   312                 $this->tpl->setVariable(
   314                     $this->
lng->txt($this->getObjType() . 
'_' . $a_set[
'perm'][
'operation'])
   318             if ($role_info[
'protected'] || $role_info[
'blocked']) {
   319                 $this->tpl->setVariable(
'PERM_DISABLED', 
'disabled="disabled"');
   321             if ($role_info[
'permission_set']) {
   322                 $this->tpl->setVariable(
'PERM_CHECKED', 
'checked="checked"');
   325             $this->tpl->parseCurrentBlock();
   347             $operations[$role_data[
'obj_id']] = $this->review->getActiveOperationsOfRole(
   358             $local_roles = $this->review->getRolesOfObject($this->
getRefId());
   360                 $roles[$role_data[
'obj_id']] = [
   361                     'blocked' => $role_data[
'blocked'],
   362                     'protected' => $role_data[
'protected'],
   363                     'local_policy' => in_array($role_data[
'obj_id'], $local_roles),
   364                     'isLocal' => ($this->
getRefId() == $role_data[
'parent']) && $role_data[
'assign'] == 
'y'   367             $perms[$counter][
'roles'] = $roles;
   368             $perms[$counter][
'show_local_policy_row'] = 1;
   377                 $roles[$role_data[
'obj_id']] = [
   378                     'blocked' => $role_data[
'blocked'],
   379                     'protected_allowed' => $this->review->isAssignable($role_data[
'obj_id'], $this->
getRefId()),
   380                     'protected_status' => $this->review->isProtected($role_data[
'parent'], $role_data[
'obj_id']),
   381                     'isLocal' => ($this->
getRefId() == $role_data[
'parent']) && $role_data[
'assign'] == 
'y'   384             $perms[$counter][
'roles'] = $roles;
   385             $perms[$counter][
'show_protected_row'] = 1;
   391             $perms[$counter++][
'show_block_row'] = 1;
   395             $perms[$counter++][
'show_start_info'] = 
true;
   399         $no_creation_operations = [];
   400         foreach ($this->review->getOperationsByTypeAndClass($this->getObjType(), 
'object') as $operation) {
   402             $no_creation_operations[] = $operation;
   406                 $roles[$role_data[
'obj_id']] =
   408                         'blocked' => $role_data[
'blocked'],
   409                         'protected' => $role_data[
'protected'],
   410                         'permission_set' => in_array($operation, (array) $operations[$role_data[
'obj_id']]),
   411                         'isLocal' => ($this->
getRefId() == $role_data[
'parent']) && $role_data[
'assign'] == 
'y'   415             $op = $this->review->getOperation($operation);
   417             $perms[$counter][
'roles'] = $roles;
   418             $perms[$counter][
'perm'] = $op;
   425         if ($no_creation_operations !== []) {
   426             $perms[$counter][
'show_select_all'] = 1;
   427             $perms[$counter][
'ops'] = $no_creation_operations;
   428             $perms[$counter][
'subtype'] = 
'nocreation';
   432         if ($this->objDefinition->isContainer($this->getObjType())) {
   433             $perms[$counter++][
'show_create_info'] = 
true;
   437         $objects = $this->objDefinition->getCreatableSubObjects($this->
getObjType());
   439         $creation_operations = [];
   440         foreach ($objects as $type => $info) {
   441             $ops_id = $ops_ids[$type] ?? null;
   448             $creation_operations[] = $ops_id;
   452                 $roles[$role_data[
'obj_id']] =
   454                         'blocked' => $role_data[
'blocked'],
   455                         'protected' => $role_data[
'protected'],
   456                         'permission_set' => in_array($ops_id, (array) $operations[$role_data[
'obj_id']]),
   457                         'isLocal' => ($this->
getRefId() == $role_data[
'parent']) && $role_data[
'assign'] == 
'y'   462             $op = $this->review->getOperation($ops_id);
   464             $perms[$counter][
'roles'] = $roles;
   465             $perms[$counter][
'perm'] = $op;
   470         if ($creation_operations !== []) {
   471             $perms[$counter][
'show_select_all'] = 1;
   472             $perms[$counter][
'ops'] = $creation_operations;
   473             $perms[$counter][
'subtype'] = 
'creation';
   484         $roles = $this->review->getParentRoleIds($this->
getRefId());
   490         $possible_roles = [];
   491         foreach ($roles as $role) {
   492             if ($this->review->isBlockedInUpperContext((
int) $role[
'obj_id'], $this->getRefId())) {
   496             $possible_roles[] = $role;
   499         if ($possible_roles !== []) {
   506         foreach ($possible_roles as $role) {
   510             $role[
'obj_id'] = (
int) $role[
'obj_id'];
   511             $role[
'blocked'] = (bool) $this->review->isBlockedAtPosition($role[
'obj_id'], $this->getRefId());
   512             $role[
'role_type'] = $this->review->isGlobalRole($role[
'obj_id']) ? 
'global' : 
'local';
   517                 (
string) $role[
'obj_id'],
   523             $all_roles[] = $role;
   534         $protected_status = $this->review->isProtected($role[
'parent'], $role[
'obj_id']) ? 
'protected_' : 
'';
   535         if ($role[
'role_type'] == 
'global') {
   536             $tp = $this->
lng->txt(
'perm_' . $protected_status . 
'global_role');
   538             $tp = $this->
lng->txt(
'perm_' . $protected_status . 
'local_role');
   541         $inheritance_seperator = 
': ';
   545             $role[
'assign'] == 
'y' && $role[
'role_type'] != 
'global' || $role[
'assign'] == 
'n' && $role[
'role_type'] != 
'global'   549             $obj = $this->review->getObjectOfRole($role[
'obj_id']);
   552                 if ($this->objDefinition->isPlugin($type)) {
   559                     $this->
lng->txt(
'perm_role_path_info_created'),
   563                 $inheritance_seperator = 
', ';
   567         $path_hierarchy = $this->review->getObjectsWithStopedInheritance(
   569             $this->tree->getPathId($this->getRefId())
   572         $reduced_path_hierarchy = array_diff(
   576                 $this->review->getObjectReferenceOfRole($role[
'obj_id'])
   581         if ($role[
'assign'] == 
'n' && count($reduced_path_hierarchy)) {
   582             $tp .= $inheritance_seperator;
   584             $parent = end($reduced_path_hierarchy);
   588                 $this->
lng->txt(
'perm_role_path_info_inheritance'),
   589                 $this->
lng->txt(
'obj_' . $p_type),
   605         if ($role[
'parent'] != $this->
getRefId()) {
   610         if ($this->objDefinition->isPlugin($type)) {
   611             if (preg_match(
"/^il_./", $role[
"title"])) {
   616         if ($role[
'blocked']) {
   619         $this->
ctrl->setParameterByClass(
'ilobjrolegui', 
'obj_id', $role[
'obj_id']);
   621         return '<a class="tblheader" href="' . $this->
ctrl->getLinkTargetByClass(
   624         ) . 
'" >' . $role_title . 
'</a>';
 setNoEntriesText(string $a_text)
 
static getLogger(string $a_component_id)
Get component logger. 
 
setFormAction(string $a_form_action, bool $a_multipart=false)
 
__construct(ilPermissionGUI $a_parent_obj, string $a_parent_cmd, int $a_ref_id)
 
static _removeObjectId(string $a_role_title)
 
addCommandButton(string $a_cmd, string $a_text, string $a_onclick='', string $a_id="", string $a_class="")
 
createTitle(array $role)
Create (linked) title. 
 
createTooltip(array $role)
Create a linked title for roles with local policy. 
 
setDisableFilterHiding(bool $a_val=true)
 
ilObjectDefinition $objDefinition
 
getVisibleRoles()
get visible roles 
 
getFilterItemByPostVar(string $a_post_var)
 
static _lookupObjId(int $ref_id)
 
getRefId()
Get ref id of current object. 
 
static lookupCreateOperationIds(array $a_type_arr)
Lookup operation ids. 
 
parses the objects.xml it handles the xml-description of all ilias objects 
 
checkForParentType(int $a_ref_id, string $a_type, bool $a_exclude_source_check=false)
Check for parent type e.g check if a folder (ref_id 3) is in a parent course obj => checkForParentTyp...
 
setShowRowsSelector(bool $a_value)
Toggle rows-per-page selector. 
 
addFilterItemByMetaType(string $id, int $type=self::FILTER_TEXT, bool $a_optional=false, string $caption="")
Add filter by standard type. 
 
static _lookupTitle(int $obj_id)
 
addActiveOperation(int $a_ops_id)
Add active operation. 
 
static _getTranslation(string $a_role_title)
 
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template. 
 
getPathIds()
Get tree path ids. 
 
static hasContainerCommands(string $a_type)
 
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
 
setVisibleRoles(array $a_ar)
 
static lookupTxtById(string $plugin_id, string $lang_var)
 
static langExitsById(string $pluginId, string $langVar)
Is searched lang var available in plugin lang files. 
 
const ROLE_FILTER_LOCAL_POLICY
 
const ROLE_FILTER_LOCAL_OBJECT
 
getActiveOperations()
get active operations 
 
setLimit(int $a_limit=0, int $a_default_limit=0)
 
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
 
disable(string $a_module_name)
 
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output. 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
static _lookupType(int $id, bool $reference=false)
 
initFilter()
Init role filter. 
 
setEnableHeader(bool $a_enableheader)