ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
ilPermissionGUI Class Reference

New PermissionGUI (extends from old ilPermission2GUI) RBAC related output. More...

+ Inheritance diagram for ilPermissionGUI:
+ Collaboration diagram for ilPermissionGUI:

Public Member Functions

 __construct ($a_gui_obj)
 Constructor. More...
 
 executeCommand ()
 Execute command. More...
 
 getCurrentObject ()
 Get current object. More...
 
 perm (ilTable2GUI $table=NULL)
 show permission table More...
 
 applyRoleFilter ($a_roles, $a_filter_id)
 Apply filter to roles. More...
 
- Public Member Functions inherited from ilPermission2GUI
 __construct ($a_gui_obj)
 
 permSave ()
 save permissions More...
 
 addRole ()
 adds a local role This method is only called when choose the option 'you may add local roles'. More...
 
__initTableGUI ()
 
 __setTableGUIBasicData (&$tbl, &$result_set, $a_from="")
 standard implementation for tables use 'from' variable use different initial setting of table More...
 
 __buildRoleFilterSelect ()
 
 __filterRoles ($a_roles, $a_filter)
 
 owner ()
 
 changeOwner ()
 
 info ()
 
 __initSubTabs ($a_cmd)
 
 getRolesData ()
 
 __showPermissionsGeneralSection ()
 
 __showPermissionsObjectSection ()
 
 __showPermissionsRBACSection ()
 
 __showPermissionsCreateSection ()
 
 log ()
 
 applyLogFilter ()
 
 resetLogFilter ()
 

Static Public Member Functions

static hasContainerCommands ($a_type)
 Check if container commands are possible for the current object type. More...
 

Protected Member Functions

 confirmTemplateSwitch ()
 Called after toolbar action applyTemplateSwitch. More...
 
 isAdminRoleFolder ()
 Check of current location is administration (main) role folder. More...
 
 isAdministrationObject ()
 
 isInAdministration ()
 Check if node is subobject of administration folder. More...
 
 applyFilter ()
 Apply filter. More...
 
 resetFilter ()
 Reset filter. More...
 
 savePermissions ()
 Save permissions. More...
 
 showConfirmBlockRole ($a_roles)
 Show block role confirmation screen. More...
 
 blockRoles ()
 Block role. More...
 
 initRoleFolder ($a_create=false)
 Init role folder of object. More...
 
 displayImportRoleForm (ilPropertyFormGUI $form=null)
 Show import form. More...
 
 doImportRole ()
 Perform import. More...
 
 initImportForm ()
 init import form More...
 
 initRoleForm ()
 Shoew add role type $rbacreview type $objDefinition. More...
 
 displayAddRoleForm ()
 Show add role form. More...
 

Protected Attributes

 $current_obj = null
 
- Protected Attributes inherited from ilPermission2GUI
 $gui_obj = null
 
 $ilErr = null
 
 $ctrl = null
 
 $lng = null
 

Detailed Description

New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e
Sascha Hofmann sasch.nosp@m.ahof.nosp@m.mann@.nosp@m.gmx..nosp@m.de
Version
$Id$

ilPermissionGUI: ilObjRoleGUI, ilRepositorySearchGUI

Definition at line 19 of file class.ilPermissionGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilPermissionGUI::__construct (   $a_gui_obj)

Constructor.

Parameters
object$a_gui_obj
Returns

Definition at line 28 of file class.ilPermissionGUI.php.

29  {
30  parent::__construct($a_gui_obj);
31  }

Member Function Documentation

◆ applyFilter()

ilPermissionGUI::applyFilter ( )
protected

Apply filter.

Returns

Definition at line 178 of file class.ilPermissionGUI.php.

References getCurrentObject(), and perm().

179  {
180  include_once './Services/AccessControl/classes/class.ilObjectRolePermissionTableGUI.php';
181  $table = new ilObjectRolePermissionTableGUI($this,'perm',$this->getCurrentObject()->getRefId());
182  $table->resetOffset();
183  $table->writeFilterToSession();
184  return $this->perm($table);
185  }
getCurrentObject()
Get current object.
perm(ilTable2GUI $table=NULL)
show permission table
+ Here is the call graph for this function:

◆ applyRoleFilter()

ilPermissionGUI::applyRoleFilter (   $a_roles,
  $a_filter_id 
)

Apply filter to roles.

Parameters
int$a_filter_id
Returns

Definition at line 206 of file class.ilPermissionGUI.php.

References ilObjectRolePermissionTableGUI\ROLE_FILTER_ALL, ilObjectRolePermissionTableGUI\ROLE_FILTER_GLOBAL, ilObjectRolePermissionTableGUI\ROLE_FILTER_LOCAL, ilObjectRolePermissionTableGUI\ROLE_FILTER_LOCAL_OBJECT, and ilObjectRolePermissionTableGUI\ROLE_FILTER_LOCAL_POLICY.

Referenced by savePermissions().

207  {
208  global $rbacreview;
209 
210  // Always delete administrator role from view
211  if(isset($a_roles[SYSTEM_ROLE_ID]))
212  {
213  unset($a_roles[SYSTEM_ROLE_ID]);
214  }
215 
216  switch ($a_filter_id)
217  {
218  // all roles in context
220 
221  return $a_roles;
222 
223  // only global roles
225 
226  $arr_global_roles = $rbacreview->getGlobalRoles();
227  $arr_remove_roles = array_diff(array_keys($a_roles),$arr_global_roles);
228 
229  foreach ($arr_remove_roles as $role_id)
230  {
231  unset($a_roles[$role_id]);
232  }
233  return $a_roles;
234 
235  // only local roles (all local roles in context that are not defined at ROLE_FOLDER_ID)
237  $arr_global_roles = $rbacreview->getGlobalRoles();
238 
239  foreach ($arr_global_roles as $role_id)
240  {
241  unset($a_roles[$role_id]);
242  }
243 
244  return $a_roles;
245  break;
246 
247  // only roles which use a local policy
249  $role_folder = $rbacreview->getRoleFolderOfObject($this->gui_obj->object->getRefId());
250 
251  if (!$role_folder)
252  {
253  return array();
254  }
255 
256  $arr_local_roles = $rbacreview->getRolesOfRoleFolder($role_folder["ref_id"]);
257  $arr_remove_roles = array_diff(array_keys($a_roles),$arr_local_roles);
258 
259  foreach ($arr_remove_roles as $role_id)
260  {
261  unset($a_roles[$role_id]);
262  }
263 
264  return $a_roles;
265 
266  // only true local role defined at current position
268 
269  $role_folder = $rbacreview->getRoleFolderOfObject($this->gui_obj->object->getRefId());
270 
271  if (!$role_folder)
272  {
273  return array();
274  }
275 
276  $arr_local_roles = $rbacreview->getRolesOfRoleFolder($role_folder["ref_id"],false);
277  $arr_remove_roles = array_diff(array_keys($a_roles),$arr_local_roles);
278 
279  foreach ($arr_remove_roles as $role_id)
280  {
281  unset($a_roles[$role_id]);
282  }
283 
284  return $a_roles;
285 
286  default:
287  return $a_roles;
288  }
289  }
+ Here is the caller graph for this function:

◆ blockRoles()

ilPermissionGUI::blockRoles ( )
protected

Block role.

Returns

Definition at line 474 of file class.ilPermissionGUI.php.

References $_POST, getCurrentObject(), and ilUtil\sendInfo().

475  {
476  global $rbacadmin,$rbacreview;
477 
478  $rolf = $rbacreview->getRoleFolderIdOfObject($this->getCurrentObject()->getRefId());
479 
480  $p_roles = $rbacreview->getParentRoleIds($this->getCurrentObject()->getRefId());
481 
482  $roles = $_POST['roles'];
483  foreach($roles as $role)
484  {
485  // Set assign to 'y' only if it is a local role
486  $assign = $rbacreview->isAssignable($role, $rolf) ? 'y' : 'n';
487 
488  // Delete permissions
489  $rbacadmin->revokeSubtreePermissions($this->getCurrentObject()->getRefId(), $role);
490 
491  // Delete template permissions
492  $rbacadmin->deleteSubtreeTemplates($this->getCurrentObject()->getRefId(), $role);
493 
494 
495  $rbacadmin->assignRoleToFolder(
496  $role,
497  $rolf,
498  $assign
499  );
500  }
501 
502  ilUtil::sendInfo($this->lng->txt('settings_saved'));
503  $this->ctrl->redirect($this,'perm');
504  }
$_POST['username']
Definition: cron.php:12
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
getCurrentObject()
Get current object.
+ Here is the call graph for this function:

◆ confirmTemplateSwitch()

ilPermissionGUI::confirmTemplateSwitch ( )
protected

Called after toolbar action applyTemplateSwitch.

Definition at line 95 of file class.ilPermissionGUI.php.

96  {
97  include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateGUI.php';
98  $this->ctrl->setReturn($this,'perm');
99  $this->ctrl->setCmdClass('ildidactictemplategui');
100  $dtpl_gui = new ilDidacticTemplateGUI($this->gui_obj);
101  $this->ctrl->forwardCommand($dtpl_gui,'confirmTemplateSwitch');
102  }
GUI class for didactic template settings inside repository objects.

◆ displayAddRoleForm()

ilPermissionGUI::displayAddRoleForm ( )
protected

Show add role form.

Definition at line 717 of file class.ilPermissionGUI.php.

References $GLOBALS, and initRoleForm().

718  {
719  $GLOBALS['ilTabs']->clearTargets();
720 
721  $form = $this->initRoleForm();
722  $this->tpl->setContent($form->getHTML());
723  }
initRoleForm()
Shoew add role type $rbacreview type $objDefinition.
$GLOBALS['ct_recipient']
+ Here is the call graph for this function:

◆ displayImportRoleForm()

ilPermissionGUI::displayImportRoleForm ( ilPropertyFormGUI  $form = null)
protected

Show import form.

Parameters
ilPropertyFormGUI$form

Definition at line 541 of file class.ilPermissionGUI.php.

References $GLOBALS, and initImportForm().

Referenced by doImportRole().

542  {
543  $GLOBALS['ilTabs']->clearTargets();
544 
545  if(!$form)
546  {
547  $form = $this->initImportForm();
548  }
549  $GLOBALS['tpl']->setContent($form->getHTML());
550  }
$GLOBALS['ct_recipient']
initImportForm()
init import form
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doImportRole()

ilPermissionGUI::doImportRole ( )
protected

Perform import.

Definition at line 555 of file class.ilPermissionGUI.php.

References $GLOBALS, displayImportRoleForm(), getCurrentObject(), initImportForm(), isAdminRoleFolder(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

556  {
557  global $rbacreview;
558 
559  $form = $this->initImportForm();
560  if($form->checkInput())
561  {
562  try {
563 
564  include_once './Services/Export/classes/class.ilImport.php';
565 
566  // For global roles set import id to parent of current ref_id (adm)
567  if($this->isAdminRoleFolder())
568  {
569  $parent_ref = $GLOBALS['tree']->getParentId($this->getCurrentObject()->getRefId());
570  }
571  else
572  {
573  $parent_ref = $this->getCurrentObject()->getRefId();
574  }
575 
576  $imp = new ilImport($parent_ref);
577  $imp->getMapping()->addMapping(
578  'Services/AccessControl',
579  'rolf',
580  0,
581  $rbacreview->getRoleFolderIdOfObject($parent_ref)
582  );
583 
584  $imp->importObject(
585  null,
586  $_FILES["importfile"]["tmp_name"],
587  $_FILES["importfile"]["name"],
588  'role'
589  );
590  ilUtil::sendSuccess($this->lng->txt('rbac_role_imported'),true);
591  $this->ctrl->redirect($this,'perm');
592  return;
593  }
594  catch(Exception $e)
595  {
596  ilUtil::sendFailure($e->getMessage());
597  $form->setValuesByPost();
598  $this->displayImportRoleForm($form);
599  return;
600  }
601  }
602  $form->setValuesByPost();
603  ilUtil::sendFailure($this->lng->txt('err_check_input'));
604  $this->displayImportRoleForm($form);
605  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
Import class.
isAdminRoleFolder()
Check of current location is administration (main) role folder.
displayImportRoleForm(ilPropertyFormGUI $form=null)
Show import form.
$GLOBALS['ct_recipient']
getCurrentObject()
Get current object.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
initImportForm()
init import form
+ Here is the call graph for this function:

◆ executeCommand()

ilPermissionGUI::executeCommand ( )

Execute command.

Returns

Definition at line 37 of file class.ilPermissionGUI.php.

References $_GET, $cmd, ilPermission2GUI\$ilErr, and $ret.

38  {
39  global $rbacsystem, $ilErr;
40 
41  // access to all functions in this class are only allowed if edit_permission is granted
42  if (!$rbacsystem->checkAccess("edit_permission",$this->gui_obj->object->getRefId()))
43  {
44  $ilErr->raiseError($this->lng->txt("permission_denied"),$ilErr->MESSAGE);
45  }
46 
47  $next_class = $this->ctrl->getNextClass($this);
48 
49  switch($next_class)
50  {
51  case "ilobjrolegui":
52  $this->ctrl->setReturn($this,'perm');
53  include_once("Services/AccessControl/classes/class.ilObjRoleGUI.php");
54  $this->gui_obj = new ilObjRoleGUI("",(int) $_GET["obj_id"], false, false);
55  $this->gui_obj->setBackTarget($this->lng->txt("perm_settings"),$this->ctrl->getLinkTarget($this, "perm"));
56  $ret = $this->ctrl->forwardCommand($this->gui_obj);
57  break;
58 
59  case 'ildidactictemplategui':
60  $this->ctrl->setReturn($this,'perm');
61  include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateGUI.php';
62  $did = new ilDidacticTemplateGUI($this->gui_obj);
63  $this->ctrl->forwardCommand($did);
64  break;
65 
66  case 'ilrepositorysearchgui':
67  // used for owner autocomplete
68  include_once('./Services/Search/classes/class.ilRepositorySearchGUI.php');
69  $rep_search = new ilRepositorySearchGUI();
70  $this->ctrl->forwardCommand($rep_search);
71  break;
72 
73  default:
74  $cmd = $this->ctrl->getCmd();
75  $this->$cmd();
76  break;
77  }
78 
79  return true;
80  }
$_GET["client_id"]
$cmd
Definition: sahs_server.php:35
GUI class for didactic template settings inside repository objects.
Class ilObjRoleGUI.

◆ getCurrentObject()

ilPermissionGUI::getCurrentObject ( )

Get current object.

Returns
ilObject

Definition at line 87 of file class.ilPermissionGUI.php.

Referenced by applyFilter(), blockRoles(), doImportRole(), initRoleFolder(), isAdministrationObject(), isAdminRoleFolder(), isInAdministration(), perm(), resetFilter(), and savePermissions().

88  {
89  return $this->gui_obj->object;
90  }
+ Here is the caller graph for this function:

◆ hasContainerCommands()

static ilPermissionGUI::hasContainerCommands (   $a_type)
static

Check if container commands are possible for the current object type.

Parameters
object$a_type
Returns

Definition at line 530 of file class.ilPermissionGUI.php.

Referenced by ilObjectRolePermissionTableGUI\parse(), and savePermissions().

531  {
532  global $objDefinition;
533 
534  return $objDefinition->isContainer($a_type) and $a_type != 'root' and $a_type != 'adm' and $a_type != 'rolf';
535  }
+ Here is the caller graph for this function:

◆ initImportForm()

ilPermissionGUI::initImportForm ( )
protected

init import form

Definition at line 610 of file class.ilPermissionGUI.php.

References ilFileInputGUI\setSuffixes().

Referenced by displayImportRoleForm(), and doImportRole().

611  {
612  include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
613  $form = new ilPropertyFormGUI();
614  $form->setFormAction($this->ctrl->getFormAction($this));
615  $form->setTitle($this->lng->txt('rbac_import_role'));
616  $form->addCommandButton('doImportRole', $this->lng->txt('import'));
617  $form->addCommandButton('perm', $this->lng->txt('cancel'));
618 
619  $zip = new ilFileInputGUI($this->lng->txt('import_file'),'importfile');
620  $zip->setSuffixes(array('zip'));
621  $form->addItem($zip);
622 
623  return $form;
624  }
This class represents a property form user interface.
This class represents a file property in a property form.
setSuffixes($a_suffixes)
Set Accepted Suffixes.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initRoleFolder()

ilPermissionGUI::initRoleFolder (   $a_create = false)
protected

Init role folder of object.

Parameters
object$a_create[optional]
Returns

Definition at line 511 of file class.ilPermissionGUI.php.

References getCurrentObject().

Referenced by savePermissions().

512  {
513  global $rbacreview;
514 
515  $rolf_id = $rbacreview->getRoleFolderIdOfObject($this->getCurrentObject()->getRefId());
516 
517  if($rolf_id)
518  {
519  return $rolf_id;
520  }
521  $rolf = $this->getCurrentObject()->createRoleFolder();
522  return $rolf->getRefId();
523  }
getCurrentObject()
Get current object.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initRoleForm()

ilPermissionGUI::initRoleForm ( )
protected

Shoew add role type $rbacreview type $objDefinition.

Returns
ilPropertyFormGUI

Definition at line 632 of file class.ilPermissionGUI.php.

References ilObjRole\_getTranslation(), ilUtil\_sortIds(), isInAdministration(), ilTextAreaInputGUI\setCols(), ilFormPropertyGUI\setInfo(), ilTextInputGUI\setValidationRegexp(), and ilUtil\sortArray().

Referenced by displayAddRoleForm().

633  {
634  global $rbacreview,$objDefinition;
635 
636  include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
637  $form = new ilPropertyFormGUI();
638  $form->setFormAction($this->ctrl->getFormAction($this));
639  $form->setTitle($this->lng->txt('role_new'));
640  $form->addCommandButton('addrole',$this->lng->txt('role_new'));
641  $form->addCommandButton('perm', $this->lng->txt('cancel'));
642 
643  $title = new ilTextInputGUI($this->lng->txt('title'),'title');
644  $title->setValidationRegexp('/^(?!il_).*$/');
645  $title->setValidationFailureMessage($this->lng->txt('msg_role_reserved_prefix'));
646  $title->setSize(40);
647  $title->setMaxLength(70);
648  $title->setRequired(true);
649  $form->addItem($title);
650 
651  $desc = new ilTextAreaInputGUI($this->lng->txt('description'),'desc');
652  $desc->setCols(40);
653  $desc->setRows(3);
654  $form->addItem($desc);
655 
656  $pro = new ilCheckboxInputGUI($this->lng->txt('role_protect_permissions'),'pro');
657  $pro->setInfo($this->lng->txt('role_protect_permissions_desc'));
658  $pro->setValue(1);
659  $form->addItem($pro);
660 
661  $pd = new ilCheckboxInputGUI($this->lng->txt('rbac_role_add_to_desktop'),'desktop');
662  $pd->setInfo($this->lng->txt('rbac_role_add_to_desktop_info'));
663  $pd->setValue(1);
664  $form->addItem($pd);
665 
666 
667  if(!$this->isInAdministration())
668  {
669  $rights = new ilRadioGroupInputGUI($this->lng->txt("rbac_role_rights_copy"), 'rights');
670  $option = new ilRadioOption($this->lng->txt("rbac_role_rights_copy_empty"), 0);
671  $rights->addOption($option);
672 
673  $parent_role_ids = $rbacreview->getParentRoleIds($this->gui_obj->object->getRefId(),true);
674  $ids = array();
675  foreach($parent_role_ids as $id => $tmp)
676  {
677  $ids[] = $id;
678  }
679 
680  // Sort ids
681  $sorted_ids = ilUtil::_sortIds($ids,'object_data','type DESC,title','obj_id');
682 
683  // Sort roles by title
684  $sorted_roles = ilUtil::sortArray(array_values($parent_role_ids), 'title', ASC);
685  $key = 0;
686 
687  foreach($sorted_ids as $id)
688  {
689  $par = $parent_role_ids[$id];
690  if ($par["obj_id"] != SYSTEM_ROLE_ID)
691  {
692  include_once './Services/AccessControl/classes/class.ilObjRole.php';
693  $option = new ilRadioOption(($par["type"] == 'role' ? $this->lng->txt('obj_role') : $this->lng->txt('obj_rolt')).": ".ilObjRole::_getTranslation($par["title"]), $par["obj_id"]);
694  $option->setInfo($par["desc"]);
695  $rights->addOption($option);
696  }
697  $key++;
698  }
699  $form->addItem($rights);
700  }
701 
702  // Local policy only for containers
703  if($objDefinition->isContainer($this->getCurrentObject()->getType()))
704  {
705  $check = new ilCheckboxInputGui($this->lng->txt("rbac_role_rights_copy_change_existing"), 'existing');
706  $check->setInfo($this->lng->txt('rbac_change_existing_objects_desc_new_role'));
707  $form->addItem($check);
708 
709  }
710 
711  return $form;
712  }
This class represents an option in a radio group.
This class represents a property form user interface.
_getTranslation($a_role_title)
isInAdministration()
Check if node is subobject of administration folder.
This class represents a checkbox property in a property form.
static sortArray($array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
setInfo($a_info)
Set Information Text.
This class represents a property in a property form.
static _sortIds($a_ids, $a_table, $a_field, $a_id_name)
Function that sorts ids by a given table field using WHERE IN E.g: __sort(array(6,7),'usr_data','lastname','usr_id') => sorts by lastname.
This class represents a text property in a property form.
This class represents a text area property in a property form.
setValidationRegexp($a_value)
Set validation regexp.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isAdministrationObject()

ilPermissionGUI::isAdministrationObject ( )
protected

Definition at line 159 of file class.ilPermissionGUI.php.

References getCurrentObject().

Referenced by perm().

160  {
161  return $this->getCurrentObject()->getType() == 'adm';
162  }
getCurrentObject()
Get current object.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isAdminRoleFolder()

ilPermissionGUI::isAdminRoleFolder ( )
protected

Check of current location is administration (main) role folder.

Returns

Definition at line 154 of file class.ilPermissionGUI.php.

References getCurrentObject().

Referenced by doImportRole(), and perm().

155  {
156  return $this->getCurrentObject()->getRefId() == ROLE_FOLDER_ID;
157  }
getCurrentObject()
Get current object.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isInAdministration()

ilPermissionGUI::isInAdministration ( )
protected

Check if node is subobject of administration folder.

Returns
type

Definition at line 168 of file class.ilPermissionGUI.php.

References $GLOBALS, and getCurrentObject().

Referenced by initRoleForm().

169  {
170  return (bool) $GLOBALS['tree']->isGrandChild(SYSTEM_FOLDER_ID,$this->getCurrentObject()->getRefId());
171  }
$GLOBALS['ct_recipient']
getCurrentObject()
Get current object.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ perm()

ilPermissionGUI::perm ( ilTable2GUI  $table = NULL)

show permission table

Returns

Definition at line 109 of file class.ilPermissionGUI.php.

References ilPermission2GUI\__initSubTabs(), getCurrentObject(), isAdministrationObject(), and isAdminRoleFolder().

Referenced by applyFilter(), resetFilter(), and savePermissions().

110  {
111  global $objDefinition, $ilToolbar;
112 
113  include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateGUI.php';
114  $dtpl = new ilDidacticTemplateGUI($this->gui_obj);
115  if($dtpl->appendToolbarSwitch(
116  $ilToolbar,
117  $this->getCurrentObject()->getType(),
118  $this->getCurrentObject()->getRefId()
119  ))
120  {
121  $ilToolbar->addSeparator();
122  }
123 
124  if($objDefinition->hasLocalRoles($this->getCurrentObject()->getType()) and
125  !$this->isAdministrationObject()
126  )
127  {
128  $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
129 
130  if(!$this->isAdminRoleFolder())
131  {
132  $ilToolbar->addButton($this->lng->txt('rbac_add_new_local_role'),$this->ctrl->getLinkTarget($this,'displayAddRoleForm'));
133  }
134  $ilToolbar->addButton($this->lng->txt('rbac_import_role'),$this->ctrl->getLinkTarget($this,'displayImportRoleForm'));
135  }
136 
137  $this->__initSubTabs("perm");
138 
139  if(!$table instanceof ilTable2GUI)
140  {
141  include_once './Services/AccessControl/classes/class.ilObjectRolePermissionTableGUI.php';
142  $table = new ilObjectRolePermissionTableGUI($this,'perm',$this->getCurrentObject()->getRefId());
143  }
144  $table->parse();
145  $this->tpl->setContent($table->getHTML());
146  }
isAdminRoleFolder()
Check of current location is administration (main) role folder.
getHTML()
Get HTML.
Class ilTable2GUI.
GUI class for didactic template settings inside repository objects.
getCurrentObject()
Get current object.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetFilter()

ilPermissionGUI::resetFilter ( )
protected

Reset filter.

Returns

Definition at line 191 of file class.ilPermissionGUI.php.

References getCurrentObject(), and perm().

192  {
193  include_once './Services/AccessControl/classes/class.ilObjectRolePermissionTableGUI.php';
194  $table = new ilObjectRolePermissionTableGUI($this,'perm',$this->getCurrentObject()->getRefId());
195  $table->resetOffset();
196  $table->resetFilter();
197 
198  return $this->perm($table);
199  }
getCurrentObject()
Get current object.
perm(ilTable2GUI $table=NULL)
show permission table
+ Here is the call graph for this function:

◆ savePermissions()

ilPermissionGUI::savePermissions ( )
protected

Save permissions.

Returns

Definition at line 295 of file class.ilPermissionGUI.php.

References $_POST, $log, ilRbacLog\add(), applyRoleFilter(), ilRbacLog\diffFaPa(), ilRbacLog\EDIT_PERMISSIONS, ilRbacLog\gatherFaPa(), getCurrentObject(), ilObjectFactory\getInstanceByObjId(), hasContainerCommands(), initRoleFolder(), ilRbacReview\lookupCreateOperationIds(), perm(), ilUtil\sendSuccess(), and showConfirmBlockRole().

296  {
297  global $rbacreview,$objDefinition,$rbacadmin;
298 
299  include_once './Services/AccessControl/classes/class.ilObjectRolePermissionTableGUI.php';
300  $table = new ilObjectRolePermissionTableGUI($this,'perm',$this->getCurrentObject()->getRefId());
301 
302  $roles = $this->applyRoleFilter(
303  $rbacreview->getParentRoleIds($this->getCurrentObject()->getRefId()),
304  $table->getFilterItemByPostVar('role')->getValue()
305  );
306 
307  // Log history
308  include_once "Services/AccessControl/classes/class.ilRbacLog.php";
309  $log_old = ilRbacLog::gatherFaPa($this->getCurrentObject()->getRefId(),array_keys((array) $roles));
310 
311 
312  # all possible create permissions
313  $possible_ops_ids = $rbacreview->getOperationsByTypeAndClass(
314  $this->getCurrentObject()->getType(),
315  'create'
316  );
317 
318  # createable (activated) create permissions
319  $create_types = $objDefinition->getCreatableSubObjects(
320  $this->getCurrentObject()->getType()
321  );
322  $createable_ops_ids = ilRbacReview::lookupCreateOperationIds(array_keys((array) $create_types));
323 
324  foreach((array) $roles as $role => $role_data)
325  {
326  if($role_data['protected'])
327  {
328  continue;
329  }
330 
331  $new_ops = array_keys((array) $_POST['perm'][$role]);
332  $old_ops = $rbacreview->getRoleOperationsOnObject(
333  $role,
334  $this->getCurrentObject()->getRefId()
335  );
336 
337  // Add operations which were enabled and are not activated.
338  foreach($possible_ops_ids as $create_ops_id)
339  {
340  if(in_array($create_ops_id,$createable_ops_ids))
341  {
342  continue;
343  }
344  if(in_array($create_ops_id,$old_ops))
345  {
346  $new_ops[] = $create_ops_id;
347  }
348  }
349 
350  $rbacadmin->revokePermission(
351  $this->getCurrentObject()->getRefId(),
352  $role
353  );
354 
355  $rbacadmin->grantPermission(
356  $role,
357  array_unique($new_ops),
358  $this->getCurrentObject()->getRefId()
359  );
360  }
361 
362  // Handle local policies.
363  $rolf_id = $this->initRoleFolder(count((array) $_POST['inherit']) ? true : false);
364  $relevant_roles = array_intersect(
365  $rbacreview->getRolesOfRoleFolder($rolf_id),
366  array_keys($roles)
367  );
368 
370  {
371  foreach($roles as $role)
372  {
373  // No action for local roles
374  if($role['parent'] == $rolf_id and $role['assign'] == 'y')
375  {
376  continue;
377  }
378  // Nothing for protected roles
379  if($role['protected'])
380  {
381  continue;
382  }
383  // Stop local policy
384  if($role['parent'] == $rolf_id and !isset($_POST['inherit'][$role['obj_id']]))
385  {
386  $role_obj = ilObjectFactory::getInstanceByObjId($role['obj_id']);
387  $role_obj->setParent($rolf_id);
388  $role_obj->delete();
389  continue;
390  }
391  // Add local policy
392  if($role['parent'] != $rolf_id and isset($_POST['inherit'][$role['obj_id']]))
393  {
394  $rbacadmin->copyRoleTemplatePermissions(
395  $role['obj_id'],
396  $role['parent'],
397  $rolf_id,
398  $role['obj_id']
399  );
400  $rbacadmin->assignRoleToFolder($role['obj_id'],$rolf_id,'n');
401  }
402  }
403  }
404 
405  // Protect permissions
407  {
408  foreach($roles as $role)
409  {
410  if($rbacreview->isAssignable($role['obj_id'], $rolf_id))
411  {
412  if(isset($_POST['protect'][$role['obj_id']]) and
413  !$rbacreview->isProtected($rolf_id, $role['obj_id']))
414  {
415  $rbacadmin->setProtected($rolf_id, $role['obj_id'], 'y');
416  }
417  elseif(!isset($_POST['protect'][$role['obj_id']]) and
418  $rbacreview->isProtected($rolf_id, $role['obj_id']))
419  {
420  $rbacadmin->setProtected($rolf_id, $role['obj_id'], 'n');
421  }
422  }
423  }
424  }
425 
426  $log_new = ilRbacLog::gatherFaPa($this->getCurrentObject()->getRefId(),array_keys((array) $roles));
427  $log = ilRbacLog::diffFaPa($log_old, $log_new);
429 
430  if(count((array) $_POST['block']))
431  {
432  return $this->showConfirmBlockRole(array_keys($_POST['block']));
433  }
434 
435 
436  ilUtil::sendSuccess($this->lng->txt('settings_saved'),true);
437  #$this->ctrl->redirect($this,'perm');
438  $this->perm();
439  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12
applyRoleFilter($a_roles, $a_filter_id)
Apply filter to roles.
static hasContainerCommands($a_type)
Check if container commands are possible for the current object type.
static gatherFaPa($a_ref_id, array $a_role_ids, $a_add_action=false)
static diffFaPa(array $a_old, array $a_new)
static lookupCreateOperationIds($a_type_arr)
Lookup operation ids.
const EDIT_PERMISSIONS
initRoleFolder($a_create=false)
Init role folder of object.
showConfirmBlockRole($a_roles)
Show block role confirmation screen.
getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
getCurrentObject()
Get current object.
perm(ilTable2GUI $table=NULL)
show permission table
static add($a_action, $a_ref_id, array $a_diff, $a_source_ref_id=false)
+ Here is the call graph for this function:

◆ showConfirmBlockRole()

ilPermissionGUI::showConfirmBlockRole (   $a_roles)
protected

Show block role confirmation screen.

Parameters
array$a_roles
Returns

Definition at line 446 of file class.ilPermissionGUI.php.

References ilObjRole\_getTranslation(), ilObject\_lookupTitle(), and ilUtil\sendInfo().

Referenced by savePermissions().

447  {
448  ilUtil::sendInfo($this->lng->txt('role_confirm_block_role_info'));
449 
450  include_once './Services/Utilities/classes/class.ilConfirmationGUI.php';
451  $confirm = new ilConfirmationGUI();
452  $confirm->setFormAction($this->ctrl->getFormAction($this));
453  $confirm->setHeaderText($this->lng->txt('role_confirm_block_role_header'));
454  $confirm->setConfirm($this->lng->txt('role_block_role'), 'blockRoles');
455  $confirm->setCancel($this->lng->txt('cancel'), 'perm');
456 
457  foreach($a_roles as $role_id)
458  {
459  include_once './Services/AccessControl/classes/class.ilObjRole.php';
460  $confirm->addItem(
461  'roles[]',
462  $role_id,
464  }
465 
466  $this->tpl->setContent($confirm->getHTML());
467 
468  }
_getTranslation($a_role_title)
static _lookupTitle($a_id)
lookup object title
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
Confirmation screen class.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $current_obj

ilPermissionGUI::$current_obj = null
protected

Definition at line 21 of file class.ilPermissionGUI.php.


The documentation for this class was generated from the following file: