19 declare(strict_types=1);
    75         $this->object_definition = $DIC[
'objDefinition'];
    76         $this->ui_service = $DIC->uiService();
    78         $this->tpl = $DIC[
'tpl'];
    79         $this->
lng = $DIC[
'lng'];
    80         $this->
ctrl = $DIC[
'ilCtrl'];
    81         $this->rbacsystem = $DIC[
'rbacsystem'];
    82         $this->rbacreview = $DIC[
'rbacreview'];
    83         $this->rbacadmin = $DIC[
'rbacadmin'];
    84         $this->
tabs = $DIC[
'ilTabs'];
    85         $this->ilErr = $DIC[
'ilErr'];
    86         $this->
http = $DIC[
'http'];
    88         $this->
toolbar = $DIC[
'ilToolbar'];
    89         $this->ui_factory = $DIC[
'ui.factory'];
    90         $this->ui_renderer = $DIC[
'ui.renderer'];
    91         $this->db = $DIC[
'ilDB'];
    92         $this->
user = $DIC[
'ilUser'];
    93         $this->tree = $DIC[
'tree'];
    98         $this->
lng->loadLanguageModule(
'rbac');
    99         $this->gui_obj = $a_gui_obj;
   100         $this->
tabs->activateTab(
'perm_settings');
   105         if (!isset($this->positionRepo)) {
   107             $this->positionRepo = 
$dic[
"repo.Positions"];
   115         if (!isset($this->permissionRepo)) {
   117             $this->permissionRepo = 
$dic[
"repo.Permissions"];
   125         if (!isset($this->operationRepo)) {
   127             $this->operationRepo = 
$dic[
"repo.Operations"];
   141         if (!$this->rbacsystem->checkAccess(
"edit_permission", $this->gui_obj->getObject()->getRefId())) {
   142             $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'permission_denied'), 
true);
   143             $this->
ctrl->redirect($this->gui_obj);
   145         $next_class = $this->
ctrl->getNextClass($this);
   146         switch ($next_class) {
   150                 if ($this->
http->wrapper()->query()->has(
'obj_id')) {
   151                     $role_id = $this->
http->wrapper()->query()->retrieve(
   156                 $this->
ctrl->setReturn($this, 
'perm');
   157                 $this->gui_obj = 
new ilObjRoleGUI(
"", $role_id, 
false, 
false);
   158                 $this->
ctrl->forwardCommand($this->gui_obj);
   161             case 'ildidactictemplategui':
   162                 $this->
ctrl->setReturn($this, 
'perm');
   164                 $this->
ctrl->forwardCommand($did);
   167             case 'ilrepositorysearchgui':
   170                 $this->
ctrl->forwardCommand($rep_search);
   173             case 'ilobjectpermissionstatusgui':
   176                 $this->
ctrl->forwardCommand($perm_stat);
   180                 $cmd = $this->
ctrl->getCmd();
   188         return $this->gui_obj->getObject();
   194         if ($dtpl->appendToolbarSwitch(
   196             $this->getCurrentObject()->getType(),
   199             $this->
toolbar->addSeparator();
   202         if ($this->object_definition->hasLocalRoles($this->getCurrentObject()->getType()) && !$this->
isAdministrationObject()
   204             $this->
toolbar->setFormAction($this->
ctrl->getFormActionByClass(ilDidacticTemplateGUI::class));
   208                     $this->ui_factory->link()->standard(
   209                         $this->
lng->txt(
'rbac_add_new_local_role'),
   210                         $this->
ctrl->getLinkTarget($this, 
'displayAddRoleForm')
   215                 $this->ui_factory->link()->standard(
   216                     $this->
lng->txt(
'rbac_import_role'),
   217                     $this->
ctrl->getLinkTarget($this, 
'displayImportRoleForm')
   227         $this->tpl->setContent($table->getHTML());
   251         $table->resetOffset();
   252         $table->writeFilterToSession();
   259         $table->resetOffset();
   260         $table->resetFilter();
   268             unset($a_roles[SYSTEM_ROLE_ID]);
   271         switch ($a_filter_id) {
   278                 $arr_global_roles = $this->rbacreview->getGlobalRoles();
   279                 $arr_remove_roles = array_diff(array_keys($a_roles), $arr_global_roles);
   280                 foreach ($arr_remove_roles as $role_id) {
   281                     unset($a_roles[$role_id]);
   287                 $arr_global_roles = $this->rbacreview->getGlobalRoles();
   288                 foreach ($arr_global_roles as $role_id) {
   289                     unset($a_roles[$role_id]);
   295                 $arr_local_roles = $this->rbacreview->getRolesOfObject($this->
getCurrentObject()->getRefId());
   296                 $arr_remove_roles = array_diff(array_keys($a_roles), $arr_local_roles);
   297                 foreach ($arr_remove_roles as $role_id) {
   298                     unset($a_roles[$role_id]);
   304                 $arr_local_roles = $this->rbacreview->getRolesOfObject($this->
getCurrentObject()->getRefId(), 
true);
   305                 $arr_remove_roles = array_diff(array_keys($a_roles), $arr_local_roles);
   306                 foreach ($arr_remove_roles as $role_id) {
   307                     unset($a_roles[$role_id]);
   321             $this->rbacreview->getParentRoleIds($this->getCurrentObject()->getRefId()),
   322             (
int) $table->getFilterItemByPostVar(
'role')->getValue()
   328         # all possible create permissions   329         $possible_ops_ids = $this->rbacreview->getOperationsByTypeAndClass(
   334         # createable (activated) create permissions   335         $create_types = $this->object_definition->getCreatableSubObjects(
   340         $post_perm = $this->
http->wrapper()->post()->has(
'perm')
   341             ? $this->
http->wrapper()->post()->retrieve(
   343                 $this->
refinery->kindlyTo()->dictOf(
   344                     $this->
refinery->kindlyTo()->dictOf(
   351         foreach ($roles as $role => $role_data) {
   352             if ($role_data[
'protected']) {
   356             $new_ops = array_keys((array) ($post_perm[$role] ?? []));
   357             $old_ops = $this->rbacreview->getRoleOperationsOnObject(
   363             foreach ($possible_ops_ids as $create_ops_id) {
   364                 if (in_array($create_ops_id, $createable_ops_ids)) {
   367                 if (in_array($create_ops_id, $old_ops)) {
   368                     $new_ops[] = $create_ops_id;
   372             $this->rbacadmin->revokePermission(
   377             $this->rbacadmin->grantPermission(
   379                 array_unique($new_ops),
   385             $inherit_post = $this->
http->wrapper()->post()->has(
'inherit')
   386                 ? $this->
http->wrapper()->post()->retrieve(
   388                     $this->
refinery->kindlyTo()->dictOf(
   394             foreach ($roles as $role) {
   395                 $obj_id = (
int) $role[
'obj_id'];
   396                 $parent_id = (
int) $role[
'parent'];
   398                 if ($parent_id === $this->
getCurrentObject()->getRefId() && $role[
'assign'] === 
'y') {
   402                 if ($role[
'protected']) {
   408                     && !isset($inherit_post[$obj_id])
   409                     && !$this->rbacreview->isBlockedAtPosition($obj_id, $this->
getCurrentObject()->getRefId())
   420                     && isset($inherit_post[$obj_id])
   423                     $this->rbacadmin->copyRoleTemplatePermissions(
   430                     $this->rbacadmin->assignRoleToFolder($obj_id, $this->
getCurrentObject()->getRefId(), 
'n');
   437             $protected_post = $this->
http->wrapper()->post()->has(
'protect')
   438                 ? $this->
http->wrapper()->post()->retrieve(
   443             foreach ($roles as $role) {
   444                 $obj_id = (
int) $role[
'obj_id'];
   445                 if ($this->rbacreview->isAssignable($obj_id, $this->getCurrentObject()->getRefId())) {
   446                     if (isset($protected_post[$obj_id]) &&
   447                         !$this->rbacreview->isProtected($this->
getCurrentObject()->getRefId(), $obj_id)) {
   448                         $this->rbacadmin->setProtected($this->
getCurrentObject()->getRefId(), $obj_id, 
'y');
   449                     } elseif (!isset($protected_post[$obj_id]) &&
   450                         $this->rbacreview->isProtected($this->getCurrentObject()->getRefId(), $obj_id)) {
   451                         $this->rbacadmin->setProtected($this->
getCurrentObject()->getRefId(), $obj_id, 
'n');
   463         if ($blocked_info[
'num'] > 0) {
   467         $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'), 
true);
   468         $this->
ctrl->redirect($this, 
'perm');
   474         if ($a_blocked_info[
'new_blocked']) {
   475             $info .= $this->
lng->txt(
'role_confirm_block_role_info');
   476             if ($a_blocked_info[
'new_unblocked']) {
   477                 $info .= 
'<br /><br />';
   480         if ($a_blocked_info[
'new_unblocked']) {
   481             $info .= (
'<br />' . $this->
lng->txt(
'role_confirm_unblock_role_info'));
   484         $this->tpl->setOnScreenMessage(
'info', $info);
   487         $confirm->setFormAction($this->
ctrl->getFormAction($this));
   488         $confirm->setHeaderText($this->
lng->txt(
'role_confirm_block_role_header'));
   489         $confirm->setConfirm($this->
lng->txt(
'role_confirm_block_role'), 
'modifyBlockRoles');
   490         $confirm->setCancel($this->
lng->txt(
'cancel'), 
'perm');
   492         foreach ($a_blocked_info[
'new_blocked'] as $role_id) {
   499         foreach ($a_blocked_info[
'new_unblocked'] as $role_id) {
   506         $this->tpl->setContent($confirm->getHTML());
   512             $this->
http->wrapper()->post()->has(
'new_block')
   513                 ? $this->
http->wrapper()->post()->retrieve(
   520             ? $this->
http->wrapper()->post()->retrieve(
   526         $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'settings_saved'));
   527         $this->
ctrl->redirect($this, 
'perm');
   532         foreach ($roles as $role) {
   539             $role_obj->changeExistingObjects(
   546             $this->rbacadmin->setBlockedStatus(
   556         foreach ($roles as $role) {
   558             $assign = $this->rbacreview->isAssignable($role, $this->
getCurrentObject()->getRefId()) ? 
'y' : 
'n';
   561             $this->rbacadmin->revokeSubtreePermissions($this->
getCurrentObject()->getRefId(), $role);
   564             $this->rbacadmin->deleteSubtreeTemplates($this->
getCurrentObject()->getRefId(), $role);
   566             $this->rbacadmin->assignRoleToFolder(
   573             $this->rbacadmin->setBlockedStatus(
   585         $objDefinition = $DIC[
'objDefinition'];
   586         return $objDefinition->isContainer($a_type) && $a_type != 
'root' && $a_type != 
'adm' && $a_type != 
'rolf';
   591         $this->
tabs->clearTargets();
   596         $this->tpl->setContent($form->getHTML());
   602         if ($form->checkInput()) {
   606                 $imp->getMapping()->addMapping(
   607                     'components/ILIAS/AccessControl',
   615                     $_FILES[
"importfile"][
"tmp_name"],
   616                     $_FILES[
"importfile"][
"name"],
   619                 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'rbac_role_imported'), 
true);
   620                 $this->
ctrl->redirect($this, 
'perm');
   623                 $this->tpl->setOnScreenMessage(
'failure', $e->getMessage());
   624                 $form->setValuesByPost();
   629         $form->setValuesByPost();
   630         $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'err_check_input'));
   637         $form->setFormAction($this->
ctrl->getFormAction($this));
   638         $form->setTitle($this->
lng->txt(
'rbac_import_role'));
   639         $form->addCommandButton(
'doImportRole', $this->
lng->txt(
'import'));
   640         $form->addCommandButton(
'perm', $this->
lng->txt(
'cancel'));
   644         $zip->setSuffixes([
'zip']);
   645         $form->addItem($zip);
   653         $form->setFormAction($this->
ctrl->getFormAction($this));
   654         $form->setTitle($this->
lng->txt(
'role_new'));
   655         $form->addCommandButton(
'addrole', $this->
lng->txt(
'role_new'));
   656         $form->addCommandButton(
'perm', $this->
lng->txt(
'cancel'));
   659         $title->setValidationRegexp(
'/^(?!il_).*$/');
   660         $title->setValidationFailureMessage($this->
lng->txt(
'msg_role_reserved_prefix'));
   662         $title->setMaxLength(70);
   663         $title->setRequired(
true);
   664         $form->addItem($title);
   669         $form->addItem($desc);
   672         $pro->setInfo($this->
lng->txt(
'role_protect_permissions_desc'));
   674         $form->addItem($pro);
   681                 $this->
lng->txt(
'rbac_add_recommended_content_info')
   684         $pd->setValue((
string) 1);
   689             $option = 
new ilRadioOption($this->
lng->txt(
"rbac_role_rights_copy_empty"), (string) 0);
   692             $parent_role_ids = $this->rbacreview->getParentRoleIds($this->gui_obj->getObject()->getRefId(), 
true);
   694             foreach (array_keys($parent_role_ids) as 
$id) {
   699             $sorted_ids = 
ilUtil::_sortIds($ids, 
'object_data', 
'type DESC,title', 
'obj_id');
   702             foreach ($sorted_ids as 
$id) {
   703                 $par = $parent_role_ids[
$id];
   706                         ($par[
"type"] == 
'role' ? $this->
lng->txt(
'obj_role') : $this->
lng->txt(
   709                         (string) $par[
"obj_id"]
   711                     $option->
setInfo($par[
"desc"] ?? 
'');
   720         if ($this->object_definition->isContainer($this->getCurrentObject()->getType())) {
   722             $check->setInfo($this->
lng->txt(
'rbac_change_existing_objects_desc_new_role'));
   730         $this->
tabs->clearTargets();
   732         $this->tpl->setContent($form->getHTML());
   744         if ($form->checkInput()) {
   745             $new_title = $form->getInput(
"title");
   748             $role->setTitle($new_title);
   749             $role->setDescription($form->getInput(
'desc'));
   752             $this->rbacadmin->assignRoleToFolder($role->getId(), $this->
getCurrentObject()->getRefId());
   755             $this->rbacadmin->setProtected(
   758                 $form->getInput(
'pro') ? 
'y' : 
'n'   762             $right_id_to_copy = (
int) $form->getInput(
"rights");
   763             if ($right_id_to_copy) {
   764                 $parentRoles = $this->rbacreview->getParentRoleIds($this->
getCurrentObject()->getRefId(), 
true);
   765                 $this->rbacadmin->copyRoleTemplatePermissions(
   767                     $parentRoles[$right_id_to_copy][
"parent"],
   773                 if ($form->getInput(
'existing')) {
   774                     if ($form->getInput(
'pro')) {
   775                         $role->changeExistingObjects(
   781                         $role->changeExistingObjects(
   791             if ($form->getInput(
"desktop")) {
   792                 $this->recommended_content_manager->addRoleRecommendation(
   798             $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"role_added"), 
true);
   799             $this->
ctrl->redirect($this, 
'perm');
   801             $form->setValuesByPost();
   802             $this->tpl->setContent($form->getHTML());
   808         $blocked_info[
'new_blocked'] = [];
   809         $blocked_info[
'new_unblocked'] = [];
   810         $blocked_info[
'num'] = 0;
   811         $visible_block = $this->
http->wrapper()->post()->has(
'visible_block')
   812             ? $this->
http->wrapper()->post()->retrieve(
   817         $block_post = $this->
http->wrapper()->post()->has(
'block')
   818             ? $this->
http->wrapper()->post()->retrieve(
   825         foreach ($visible_block as $role => $one) {
   826             $blocked = $this->rbacreview->isBlockedAtPosition($role, $this->
getCurrentObject()->getRefId());
   827             if (isset($block_post[$role]) && !$blocked) {
   828                 $blocked_info[
'new_blocked'][] = $role;
   829                 $blocked_info[
'num']++;
   831             if (!isset($block_post[$role]) && $blocked) {
   832                 $blocked_info[
'new_unblocked'][] = $role;
   833                 $blocked_info[
'num']++;
   836         return $blocked_info;
   841         $perm = self::CMD_PERM_POSITIONS;
   846         $table->collectData();
   847         $this->tpl->setContent($table->getHTML());
   857         $positions_with_local_perms_from_post = $this->
http->wrapper()->post()->has(
'local')
   858             ? $this->
http->wrapper()->post()->retrieve(
   864         foreach ($positions as $position_id) {
   865             if (isset($positions_with_local_perms_from_post[$position_id])) {
   872         $position_perm_post = $this->
http->wrapper()->post()->has(
'position_perm')
   873             ? $this->
http->wrapper()->post()->retrieve(
   875                 $this->
refinery->kindlyTo()->dictOf(
   876                     $this->
refinery->kindlyTo()->dictOf(
   883         foreach ($position_perm_post as $position_id => $ops) {
   884             if (!isset($positions_with_local_perms_from_post[$position_id])) {
   888             if (!$org_unit_permissions->isTemplate()) {
   890                 foreach ($ops as $op_id => $op) {
   894                     $org_unit_permissions->withOperations($new_ops)
   899         foreach (array_keys($positions_with_local_perms_from_post) as $position_id_from_post) {
   900             if (array_key_exists($position_id_from_post, $position_perm_post)) {
   904             if ($org_unit_permissions !== null && !$org_unit_permissions->isTemplate()) {
   909         $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'), 
true);
   910         $this->
ctrl->redirect($this, self::CMD_PERM_POSITIONS);
   918         $form->setFormAction($this->
ctrl->getFormAction($this, 
"owner"));
   919         $form->setTitle($this->
lng->txt(
"info_owner_of_object"));
   922         $login->setDataSource($this->
ctrl->getLinkTargetByClass([get_class($this),
   923                                                                       'ilRepositorySearchGUI'   924         ], 
'doUserAutoComplete', 
'', 
true));
   925         $login->setRequired(
true);
   927         $login->setInfo($this->
lng->txt(
"chown_warning"));
   929         $form->addItem($login);
   930         $form->addCommandButton(
"changeOwner", $this->
lng->txt(
"change_owner"));
   931         $this->tpl->setContent($form->getHTML());
   937         if ($this->
http->wrapper()->post()->has(
'owner')) {
   938             $owner = $this->
http->wrapper()->post()->retrieve(
   940                 $this->
refinery->kindlyTo()->string()
   944             $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'user_not_known'));
   950         if (
$user_id != $this->gui_obj->getObject()->getOwner()) {
   951             $this->gui_obj->getObject()->setOwner(
$user_id);
   952             $this->gui_obj->getObject()->updateOwner();
   953             $this->
objectDataCache->deleteCachedEntry($this->gui_obj->getObject()->getId());
   960         $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'owner_updated'), 
true);
   962         if (!$this->rbacsystem->checkAccess(
"edit_permission", $this->gui_obj->getObject()->getRefId())) {
   963             $this->
ctrl->redirect($this->gui_obj);
   966         $this->
ctrl->redirect($this, 
'owner');
   971         $perm = $a_cmd === 
'perm';
   973         $info = $a_cmd === 
'perminfo';
   974         $owner = $a_cmd === 
'owner';
   975         $log = $a_cmd === 
'log';
   977         $this->
tabs->addSubTabTarget(
   978             "permission_settings",
   979             $this->
ctrl->getLinkTarget($this, 
"perm"),
   987             $this->
tabs->addSubTabTarget(
   988                 self::TAB_POSITION_PERMISSION_SETTINGS,
   997         $this->
tabs->addSubTabTarget(
   999             $this->
ctrl->getLinkTargetByClass([get_class($this), 
"ilobjectpermissionstatusgui"], 
"perminfo"),
  1005         $this->
tabs->addSubTabTarget(
  1007             $this->
ctrl->getLinkTarget($this, 
"owner"),
  1015             $this->
tabs->addSubTabTarget(
  1017                 $this->
ctrl->getLinkTarget($this, 
'log'),
  1029             $this->
ctrl->redirect($this, 
'perm');
  1037             $this->data_factory,
  1041             $this->object_definition,
  1042             $this->
http->request(),
  1047         $this->tpl->setContent($this->ui_renderer->render(
  1048             $table->getTableAndFilter()
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
ilObjectDefinition $object_definition
 
static getLogger(string $a_component_id)
Get component logger. 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
addRole()
adds a local role This method is only called when choose the option 'you may add local roles'...
 
__initSubTabs(string $a_cmd)
 
ilOrgUnitPositionDBRepository $positionRepo
 
isInAdministration()
Check if node is subobject of administration folder. 
 
showConfirmBlockRole(array $a_blocked_info)
 
static _lookupId($a_user_str)
 
ilOrgUnitOperationDBRepository $operationRepo
 
const MODE_PROTECTED_KEEP_LOCAL_POLICIES
 
ilOrgUnitPermissionDBRepository $permissionRepo
 
ilRecommendedContentManager $recommended_content_manager
 
static lookupCreateOperationIds(array $a_type_arr)
Lookup operation ids. 
 
static gatherFaPa(int $ref_id, array $role_ids, bool $add_action=false)
 
displayImportRoleForm(ilPropertyFormGUI $form=null)
 
ilObjectDataCache $objectDataCache
 
static http()
Fetches the global http state from ILIAS. 
 
getModifiedBlockedSettings()
 
static _lookupTitle(int $obj_id)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
static _getTranslation(string $a_role_title)
 
Class ilObjectGUI Basic methods of all Output classes. 
 
static hasContainerCommands(string $a_type)
 
unblockRoles(array $roles)
 
static _sortIds(array $a_ids, string $a_table, string $a_field, string $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. 
 
static add(int $action, int $ref_id, array $diff, bool $source_ref_id=false)
 
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id 
 
static diffFaPa(array $old, array $new)
 
const ROLE_FILTER_LOCAL_POLICY
 
const ROLE_FILTER_LOCAL_OBJECT
 
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins 
 
__construct(Container $dic, ilPlugin $plugin)
 
This class represents a text area property in a property form. 
 
const MODE_UNPROTECTED_KEEP_LOCAL_POLICIES
 
DataFactory $data_factory
 
executeCommand()
Execute command. 
 
ilGlobalTemplateInterface $tpl
 
applyRoleFilter(array $a_roles, int $a_filter_id)
 
Class ilRbacAdmin Core functions for role based access control. 
 
savePositionsPermissions()
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
const CMD_SAVE_POSITIONS_PERMISSIONS
 
class ilRbacLog Log changes in Rbac-related settings 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
perm(ilTable2GUI $table=null)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
const TAB_POSITION_PERMISSION_SETTINGS
 
static _lookupLogin(int $a_user_id)