4 include_once (
'./Services/Table/classes/class.ilTable2GUI.php');
5 include_once
'./Services/AccessControl/classes/class.ilPermissionGUI.php';
6 require_once(
'./Services/Repository/classes/class.ilObjectPlugin.php');
37 public function __construct($a_parent_obj,$a_parent_cmd, $a_ref_id)
41 parent::__construct($a_parent_obj,$a_parent_cmd);
43 $this->lng->loadLanguageModule(
'rbac');
45 $this->ref_id = $a_ref_id;
46 $this->tree_path_ids = $tree->getPathId($this->ref_id);
48 $this->
setId(
'objroleperm_'.$this->ref_id);
50 $tpl->addJavaScript(
'./Services/AccessControl/js/ilPermSelect.js');
52 $this->
setTitle($this->lng->txt(
'permission_settings'));
55 $this->
setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
57 $this->
setRowTemplate(
"tpl.obj_role_perm_row.html",
"Services/AccessControl");
112 $this->activeOperations[] = $a_ops_id;
131 $this->visible_roles = $a_ar;
159 if ($tree->checkForParentType($this->getRefId(),
'crs')
or 160 $tree->checkForParentType($this->getRefId(),
'grp'))
162 $roles->setValue(self::ROLE_FILTER_LOCAL);
166 $roles->setValue(self::ROLE_FILTER_ALL);
173 self::ROLE_FILTER_ALL => $this->lng->txt(
'filter_all_roles'),
174 self::ROLE_FILTER_GLOBAL => $this->lng->txt(
'filter_global_roles'),
175 self::ROLE_FILTER_LOCAL => $this->lng->txt(
'filter_local_roles'),
176 self::ROLE_FILTER_LOCAL_POLICY => $this->lng->txt(
'filter_roles_local_policy'),
177 self::ROLE_FILTER_LOCAL_OBJECT => $this->lng->txt(
'filter_local_roles_object')
190 global $objDefinition;
194 if(isset(
$row[
'show_local_policy_row']))
196 foreach(
$row[
'roles'] as $role_id => $role_info)
198 $this->tpl->setCurrentBlock(
'role_option');
199 $this->tpl->setVariable(
'INHERIT_ROLE_ID',$role_id);
200 $this->tpl->setVariable(
'INHERIT_CHECKED',$role_info[
'local_policy'] ?
'checked=checked' :
'');
201 $this->tpl->setVariable(
'INHERIT_DISABLED',($role_info[
'protected']
or $role_info[
'isLocal']
or $role_info[
'blocked']) ?
'disabled="disabled"' :
'');
202 $this->tpl->setVariable(
'TXT_INHERIT',$this->lng->txt(
'rbac_local_policy'));
203 $this->tpl->setVariable(
'INHERIT_LONG',$this->lng->txt(
'perm_use_local_policy_desc'));
204 $this->tpl->parseCurrentBlock();
209 if(isset(
$row[
'show_protected_row']))
211 foreach(
$row[
'roles'] as $role_id => $role_info)
213 $this->tpl->setCurrentBlock(
'role_protect');
214 $this->tpl->setVariable(
'PROTECT_ROLE_ID',$role_id);
215 $this->tpl->setVariable(
'PROTECT_CHECKED',$role_info[
'protected_status'] ?
'checked=checked' :
'');
216 $this->tpl->setVariable(
'PROTECT_DISABLED',$role_info[
'protected_allowed'] ?
'' :
'disabled="disabled"');
217 $this->tpl->setVariable(
'TXT_PROTECT',$this->lng->txt(
'role_protect_permissions'));
218 $this->tpl->setVariable(
'PROTECT_LONG',$this->lng->txt(
'role_protect_permissions_desc'));
219 $this->tpl->parseCurrentBlock();
225 if(isset(
$row[
'show_block_row']))
229 $this->tpl->setCurrentBlock(
'role_block');
230 $this->tpl->setVariable(
'BLOCK_ROLE_ID',$role_info[
'obj_id']);
231 $this->tpl->setVariable(
'TXT_BLOCK',$this->lng->txt(
'role_block_role'));
232 $this->tpl->setVariable(
'BLOCK_LONG',$this->lng->txt(
'role_block_role_desc'));
233 if($role_info[
'blocked'])
235 $this->tpl->setVariable(
'BLOCK_CHECKED',
'checked="checked"');
238 ($role_info[
'protected'] ==
'y') ||
239 ($role_info[
'assign'] ==
'y' and ($role_info[
'parent'] == $this->
getRefId()))
242 $this->tpl->setVariable(
'BLOCK_DISABLED',
'disabled="disabled');
245 $this->tpl->parseCurrentBlock();
251 if(isset(
$row[
'show_select_all']))
255 $this->tpl->setCurrentBlock(
'role_select_all');
256 $this->tpl->setVariable(
'JS_ROLE_ID',$role[
'obj_id']);
257 $this->tpl->setVariable(
'JS_SUBID',
$row[
'subtype']);
258 $this->tpl->setVariable(
'JS_ALL_PERMS',
"['".implode(
"','",
$row[
'ops']).
"']");
259 $this->tpl->setVariable(
'JS_FORM_NAME',$this->
getFormName());
260 $this->tpl->setVariable(
'TXT_SEL_ALL',$this->lng->txt(
'select_all'));
261 $this->tpl->parseCurrentBlock();
267 if(isset(
$row[
'show_start_info']))
269 $this->tpl->setCurrentBlock(
'section_info');
270 $this->tpl->setVariable(
'SECTION_TITLE',$this->lng->txt(
'perm_class_object'));
271 $this->tpl->setVariable(
'SECTION_DESC',$this->lng->txt(
'perm_class_object_desc'));
272 $this->tpl->parseCurrentBlock();
277 if(isset(
$row[
'show_create_info']))
279 $this->tpl->setCurrentBlock(
'section_info');
280 $this->tpl->setVariable(
'SECTION_TITLE',$this->lng->txt(
'perm_class_create'));
281 $this->tpl->setVariable(
'SECTION_DESC',$this->lng->txt(
'perm_class_create_desc'));
282 $this->tpl->parseCurrentBlock();
287 foreach((
array)
$row[
'roles'] as $role_id => $role_info)
289 $this->tpl->setCurrentBlock(
'role_td');
290 $this->tpl->setVariable(
'PERM_ROLE_ID',$role_id);
291 $this->tpl->setVariable(
'PERM_PERM_ID',
$row[
'perm'][
'ops_id']);
294 if(substr(
$row[
'perm'][
'operation'],0,6) ==
'create')
296 if ($objDefinition->isPlugin(substr(
$row[
'perm'][
'operation'],7)))
299 "obj_".substr(
$row[
'perm'][
'operation'],7));
303 $perm = $this->lng->txt(
'obj_'.substr(
$row[
'perm'][
'operation'],7));
308 if($this->lng->exists($this->getObjType().
'_'.
$row[
'perm'][
'operation'].
'_short'))
310 $perm = $this->lng->txt($this->
getObjType().
'_'.
$row[
'perm'][
'operation'].
'_short');
314 $perm = $this->lng->txt(
$row[
'perm'][
'operation']);
318 $this->tpl->setVariable(
'TXT_PERM',$perm);
320 if ($objDefinition->isPlugin($this->getObjType()))
325 elseif(substr(
$row[
'perm'][
'operation'],0,6) ==
'create')
327 $this->tpl->setVariable(
'PERM_LONG',$this->lng->txt(
'rbac_'.$row[
'perm'][
'operation']));
331 $this->tpl->setVariable(
'PERM_LONG',$this->lng->txt($this->getObjType().
'_'.
$row[
'perm'][
'operation']));
334 if($role_info[
'protected'] || $role_info[
'blocked'])
336 $this->tpl->setVariable(
'PERM_DISABLED',
'disabled="disabled"');
338 if($role_info[
'permission_set'])
340 $this->tpl->setVariable(
'PERM_CHECKED',
'checked="checked"');
343 $this->tpl->parseCurrentBlock();
354 global $rbacreview,$objDefinition;
367 $operations =
array();
370 $operations[$role_data[
'obj_id']] = $rbacreview->getActiveOperationsOfRole($this->
getRefId(), $role_data[
'obj_id']);
379 $local_roles = $rbacreview->getRolesOfObject($this->
getRefId());
383 'blocked' => $role_data[
'blocked'],
384 'protected' => $role_data[
'protected'],
385 'local_policy' => in_array($role_data[
'obj_id'],$local_roles),
386 'isLocal' => ($this->
getRefId() == $role_data[
'parent']) && $role_data[
'assign'] ==
'y' 390 $perms[
$counter][
'show_local_policy_row'] = 1;
402 'blocked' => $role_data[
'blocked'],
403 'protected_allowed' => $rbacreview->isAssignable($role_data[
'obj_id'],$this->getRefId()),
404 'protected_status' => $rbacreview->isProtected($role_data[
'parent'], $role_data[
'obj_id']),
405 'isLocal' => ($this->
getRefId() == $role_data[
'parent']) && $role_data[
'assign'] ==
'y' 409 $perms[
$counter][
'show_protected_row'] = 1;
416 $perms[
$counter++][
'show_block_row'] = 1;
422 $perms[
$counter++][
'show_start_info'] =
true;
426 $no_creation_operations =
array();
427 foreach($rbacreview->getOperationsByTypeAndClass($this->getObjType(),
'object') as $operation)
430 $no_creation_operations[] = $operation;
435 $roles[$role_data[
'obj_id']] =
437 'blocked' => $role_data[
'blocked'],
438 'protected' => $role_data[
'protected'],
439 'permission_set' => in_array($operation,(
array) $operations[$role_data[
'obj_id']]),
440 'isLocal' => ($this->
getRefId() == $role_data[
'parent']) && $role_data[
'assign'] ==
'y' 444 $op = $rbacreview->getOperation($operation);
455 if($no_creation_operations)
457 $perms[
$counter][
'show_select_all'] = 1;
458 $perms[
$counter][
'ops'] = $no_creation_operations;
459 $perms[
$counter][
'subtype'] =
'nocreation';
464 if($objDefinition->isContainer($this->getObjType()))
466 $perms[
$counter++][
'show_create_info'] =
true;
470 $objects = $objDefinition->getCreatableSubObjects($this->
getObjType());
472 $creation_operations =
array();
473 foreach($objects as $type =>
$info)
475 $ops_id = $ops_ids[$type];
483 $creation_operations[] = $ops_id;
488 $roles[$role_data[
'obj_id']] =
490 'blocked' => $role_data[
'blocked'],
491 'protected' => $role_data[
'protected'],
492 'permission_set' => in_array($ops_id,(
array) $operations[$role_data[
'obj_id']]),
493 'isLocal' => ($this->
getRefId() == $role_data[
'parent']) && $role_data[
'assign'] ==
'y' 498 $op = $rbacreview->getOperation($ops_id);
509 if(count($creation_operations))
511 $perms[
$counter][
'show_select_all'] = 1;
512 $perms[
$counter][
'ops'] = $creation_operations;
513 $perms[
$counter][
'subtype'] =
'creation';
534 $possible_roles =
array();
537 if($rbacreview->isBlockedInUpperContext($role[
'obj_id'],$this->getRefId()))
542 $possible_roles[] = $role;
546 if(count($possible_roles))
553 $column_widht =
"0%";
556 $all_roles =
array();
557 foreach($possible_roles as $role)
559 if($role[
'obj_id'] == SYSTEM_ROLE_ID)
564 $role[
'blocked'] = (bool) $rbacreview->isBlockedAtPosition($role[
'obj_id'],$this->getRefId());
565 $role[
'role_type'] = $rbacreview->isGlobalRole($role[
'obj_id']) ?
'global' :
'local';
576 $all_roles[] = $role;
590 global $rbacreview,$tree;
593 $protected_status = $rbacreview->isProtected($role[
'parent'], $role[
'obj_id']) ?
'protected_' :
'';
594 if($role[
'role_type'] ==
'global')
596 $tp = $this->lng->txt(
'perm_'.$protected_status.
'global_role');
600 $tp = $this->lng->txt(
'perm_'.$protected_status.
'local_role');
603 $inheritance_seperator =
': ';
607 ($role[
'assign'] ==
'y' and $role[
'role_type'] !=
'global')
or 608 ($role[
'assign'] ==
'n' and $role[
'role_type'] !=
'global')
613 $obj = $rbacreview->getObjectOfRole($role[
'obj_id']);
617 $this->lng->txt(
'perm_role_path_info_created'),
620 $inheritance_seperator =
', ';
624 $path_hierarchy = $rbacreview->getObjectsWithStopedInheritance(
626 $tree->getPathId($this->getRefId())
629 $reduced_path_hierarchy = (
array) array_diff(
633 $rbacreview->getObjectReferenceOfRole($role[
'obj_id'])
639 if($role[
'assign'] ==
'n' and count($reduced_path_hierarchy))
641 $tp .= $inheritance_seperator;
643 $parent = end($reduced_path_hierarchy);
646 $tp .= sprintf($this->lng->txt(
'perm_role_path_info_inheritance'),$this->lng->txt(
'obj_'.$p_type),$p_title);
661 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
665 if($role[
'parent'] != $this->
getRefId())
667 return $role[
'title'];
671 return $role[
'title'];
673 $ilCtrl->setParameterByClass(
'ilobjrolegui',
'obj_id', $role[
'obj_id']);
675 return '<a class="tblheader" href="'.$ilCtrl->getLinkTargetByClass(
'ilobjrolegui',
'').
'" >'.$role[
'title'].
'</a>';
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
initColumns()
init Columns
addActiveOperation($a_ops_id)
Add active operation.
static lookupTxtById($plugin_id, $lang_var)
addFilterItemByMetaType($id, $type=self::FILTER_TEXT, $a_optional=false, $caption=NULL)
Add filter by standard type.
setVisibleRoles($a_ar)
Set Visible roles.
getFilterItemByPostVar($a_post_var)
__construct($a_parent_obj, $a_parent_cmd, $a_ref_id)
Constructor.
static _lookupTitle($a_id)
lookup object title
getFormName()
Get Form name.
fillRow($row)
Fill one permission row.
static hasContainerCommands($a_type)
Check if container commands are possible for the current object type.
setNoEntriesText($a_text)
Set text for an empty table.
getVisibleRoles()
get visible roles
getParentObject()
Get parent object.
static lookupCreateOperationIds($a_type_arr)
Lookup operation ids.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
getRefId()
Get ref id of current object.
createTitle($role)
Create (linked) title.
setDisableFilterHiding($a_val=true)
Set disable filter hiding.
static _lookupObjId($a_id)
getPathIds()
Get tree path ids.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
static _getTranslation($a_role_title)
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
createTooltip($role)
Create a linked title for roles with local policy.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
disable($a_module_name)
diesables particular modules of table
const ROLE_FILTER_LOCAL_POLICY
const ROLE_FILTER_LOCAL_OBJECT
getActiveOperations()
get active operations
setShowRowsSelector($a_value)
Toggle rows-per-page selector.
setEnableHeader($a_enableheader)
Set Enable Header.
static getLogger($a_component_id)
Get component logger.
Table for object role permissions.
addColumn($a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
initFilter()
Init role filter.
setLimit($a_limit=0, $a_default_limit=0)