19declare(strict_types=1);
58 bool $a_call_by_reference =
false,
59 bool $a_prepare_output =
true
64 $this->
help = $DIC[
'ilHelp'];
65 $this->
logger = $DIC->logger()->ac();
67 $this->role_id = $a_id;
69 $this->ui_factory =
$DIC[
'ui.factory'];
70 $this->ui_renderer =
$DIC[
'ui.renderer'];
81 $this->
ctrl->saveParameter($this, [
'obj_id',
'rolf_ref_id']);
82 $this->
lng->loadLanguageModule(
'rbac');
89 $next_class = $this->
ctrl->getNextClass($this);
90 $cmd = $this->
ctrl->getCmd();
94 switch ($next_class) {
95 case 'ilrepositorysearchgui':
97 if (!$this->
access->checkAccess(
'edit_permission',
'', $this->obj_ref_id)) {
98 $this->
error->raiseError(
99 $this->
lng->txt(
'permission_denied'),
100 $this->error->WARNING
104 $rep_search->setTitle($this->
lng->txt(
'role_add_user'));
105 $rep_search->setCallback($this,
'addUserObject');
108 $this->tabs_gui->setTabActive(
'user_assignment');
109 $this->
ctrl->setReturn($this,
'userassignment');
110 $ret = $this->
ctrl->forwardCommand($rep_search);
115 $this->tabs_gui->setTabActive(
'export');
121 $this->
ctrl->forwardCommand($exp);
124 case 'ilrecommendedcontentroleconfiggui':
125 $this->tabs_gui->setTabActive(
'rep_recommended_content');
127 $this->
ctrl->forwardCommand($ui);
135 $cmd =
'userassignment';
152 $this->obj_ref_id = 0;
154 if ($this->
http->wrapper()->query()->has(
'rolf_ref_id')) {
155 $this->obj_ref_id = $this->
http->wrapper()->query()->retrieve(
159 } elseif ($this->
http->wrapper()->query()->has(
'ref_id')) {
160 $this->obj_ref_id = $this->
http->wrapper()->query()->retrieve(
169 $template_permissions = [];
170 if ($this->
http->wrapper()->post()->has(
'template_perm')) {
171 $custom_transformer = $this->
refinery->custom()->transformation(
176 $template_permissions = $this->
http->wrapper()->post()->retrieve(
181 return $template_permissions;
230 || $this->obj_definition->isAdministrationObject($this->
getContainerType());
233 protected function getRoleForm(
bool $is_role_creation_form =
false): StandardForm
235 if ($this->creation_mode) {
236 $this->
ctrl->setParameter($this,
'new_type',
'role');
239 $ff = $this->ui_factory->input()->field();
241 $title_validation_constraint = $this->
refinery->custom()->constraint(
242 fn(
string $v):
bool => preg_match(
'/^il_.*$/', $v) ?
false :
true,
243 $this->
lng->txt(
'msg_role_reserved_prefix')
246 $role_is_autogenerated =
false;
248 if (!$is_role_creation_form) {
249 $role_is_autogenerated = $this->
object->isAutoGenerated();
253 self::FORM_KEY_TITLE => $ff->text($this->
lng->txt(
'title'))
256 ->withAdditionalTransformation($title_validation_constraint)
257 ->withValue($is_role_creation_form ?
'' : $this->
object->getTitle())
258 ->withDisabled($role_is_autogenerated),
259 self::FORM_KEY_DESCRIPTION => $ff->textarea($this->
lng->txt(
'description'))
261 ->withValue($is_role_creation_form ?
'' : $this->
object->getDescription())
262 ->withDisabled($role_is_autogenerated),
266 if (!$is_role_creation_form) {
270 . $this->
object->getType() .
'_' . $this->object->getId());
275 ->withValue($is_role_creation_form ?
false : $this->
object->getAllowRegister());
277 ->withValue($is_role_creation_form ?
false : $this->
object->getAssignUsersStatus());
282 $is_role_creation_form
284 : $this->rbac_review->isProtected($this->obj_ref_id, $this->object->getId())
287 return $this->ui_factory->input()->container()->form()->standard(
288 $this->
ctrl->getFormActionByClass(
290 $is_role_creation_form ?
'save' :
'update'
294 $is_role_creation_form ? $this->
lng->txt(
'role_new') : $this->lng->txt(
'save')
300 if (!$this->rbac_system->checkAccess(
'create_role', $this->obj_ref_id)) {
301 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'permission_denied'),
true);
302 $this->
ctrl->returnToParent(ilRepositoryGUI::class);
305 $this->tabs_gui->setBackTarget(
306 $this->
lng->txt(
'cancel'),
307 $this->ctrl->getParentReturnByClass(self::class)
310 $this->tpl->setContent(
311 $this->ui_renderer->render(
312 $this->ui_factory->panel()->standard(
313 $this->lng->txt(
'role_new'),
314 $this->getRoleForm(
true)
322 if (!$this->
checkAccess(
'write',
'edit_permission')) {
323 $this->tpl->setOnScreenMessage(
'msg_no_perm_write', $this->
lng->txt(
'permission_denied'),
true);
324 $this->
ctrl->returnToParent($this);
326 $this->tabs_gui->activateTab(
'edit_properties');
337 $form = $this->
getRoleForm(
true)->withRequest($this->request);
338 $data = $form->getData();
339 if (
$data ===
null) {
340 $this->tabs_gui->setBackTarget(
341 $this->
lng->txt(
'cancel'),
342 $this->ctrl->getParentReturnByClass(self::class)
344 $this->tpl->setContent(
345 $this->ui_renderer->render(
346 $this->ui_factory->panel()->standard(
347 $this->lng->txt(
'role_new'),
356 $role->setTitle(
$data[self::FORM_KEY_TITLE]);
357 $role->setDescription(
$data[self::FORM_KEY_DESCRIPTION]);
358 $role->setAllowRegister(
$data[self::FORM_KEY_ON_REGISTRATION_FORM]);
359 $role->toggleAssignUsersStatus(
$data[self::FORM_KEY_ALLOW_LOCAL_USER_ASSIGNMENT]);
361 $this->rbac_admin->assignRoleToFolder($role->getId(), $this->obj_ref_id,
'y');
362 $this->rbac_admin->setProtected(
365 $data[self::FORM_KEY_PROTECT] ?
'y' :
'n'
367 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'role_added'),
true);
368 $this->
ctrl->setParameter($this,
'obj_id', $role->getId());
369 $this->
ctrl->redirect($this,
'perm');
378 $form = $this->
getRoleForm()->withRequest($this->request);
379 $data = $form->getData();
380 if (
$data ===
null) {
385 if (isset(
$data[self::FORM_KEY_TITLE])) {
386 $this->
object->setTitle(
$data[self::FORM_KEY_TITLE]);
388 if (isset(
$data[self::FORM_KEY_DESCRIPTION])) {
389 $this->
object->setDescription(
$data[self::FORM_KEY_DESCRIPTION]);
391 if (isset(
$data[self::FORM_KEY_ON_REGISTRATION_FORM])) {
392 $this->
object->setAllowRegister(
$data[self::FORM_KEY_ON_REGISTRATION_FORM]);
394 if (isset(
$data[self::FORM_KEY_ALLOW_LOCAL_USER_ASSIGNMENT])) {
395 $this->
object->toggleAssignUsersStatus(
$data[self::FORM_KEY_ALLOW_LOCAL_USER_ASSIGNMENT]);
397 $this->
object->update();
398 $this->rbac_admin->setProtected(
401 $data[self::FORM_KEY_PROTECT] ?
'y' :
'n'
404 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'saved_successfully'),
true);
405 $this->
ctrl->redirect($this,
'edit');
412 $this->
toolbar->setFormAction($this->
ctrl->getFormAction($this));
413 if ($this->rbac_review->isDeleteable($this->object->getId(), $this->obj_ref_id)) {
416 $this->ui_factory->button()->standard(
417 $this->lng->txt(
'rbac_delete_role'),
418 $modal->getShowSignal()
421 $page_content[] = $modal;
425 $page_content[] = $this->ui_factory->panel()->standard(
426 $this->
lng->txt(
'role_edit'),
427 $form ?? $this->getRoleForm()
430 $this->tpl->setContent(
431 $this->ui_renderer->render($page_content)
435 protected function permObject(
bool $a_show_admin_permissions =
false): void
437 $this->tabs_gui->setTabActive(
'default_perm_settings');
441 if (!$this->
checkAccess(
'write',
'edit_permission')) {
442 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'msg_no_perm_write'),
true);
443 $this->
ctrl->returnToParent($this);
446 if ($a_show_admin_permissions) {
447 $this->tabs_gui->setSubTabActive(
'rbac_admin_permissions');
449 $this->tabs_gui->setSubTabActive(
'rbac_repository_permissions');
452 $this->tpl->addBlockFile(
455 'tpl.rbac_template_permissions.html',
456 'components/ILIAS/AccessControl'
460 $this->
toolbar->setFormAction($this->
ctrl->getFormAction($this));
462 $this->ui_factory->link()->standard(
463 $this->lng->txt(
"adopt_perm_from_template"),
464 $this->ctrl->getLinkTarget($this,
'adoptPerm')
467 if ($this->rbac_review->isDeleteable($this->object->getId(), $this->obj_ref_id)) {
470 $this->ui_factory->button()->standard(
471 $this->lng->txt(
'rbac_delete_role'),
472 $modal->getShowSignal()
475 $this->tpl->setVariable(
'DELETION_MODAL', $this->ui_renderer->render($modal));
479 $this->tpl->setVariable(
'PERM_ACTION', $this->
ctrl->getFormAction($this));
486 if ($a_show_admin_permissions) {
487 $subs = ilObjRole::getSubObjects(
'adm',
true);
489 $subs = ilObjRole::getSubObjects(
'root',
false);
492 $subs = ilObjRole::getSubObjects($this->
getParentType(), $a_show_admin_permissions);
495 foreach ($subs as $subtype => $def) {
502 $a_show_admin_permissions
506 $acc->addItem($def[
'translation'], $tbl->getHTML());
509 $this->tpl->setVariable(
'ACCORDION', $acc->getHTML());
517 $a_show_admin_permissions
521 $a_show_admin_permissions ?
'adminPermSave' :
'permSave',
522 $this->
lng->txt(
'save')
527 $this->tpl->setVariable(
'OPTIONS_TABLE',
$options->getHTML());
543 $parent_role_ids = $this->rbac_review->getParentRoleIds($this->obj_ref_id,
true);
545 $this->tabs_gui->clearTargets();
548 foreach (array_keys($parent_role_ids) as
$id) {
552 $sorted_ids =
ilUtil::_sortIds($ids,
'object_data',
'type,title',
'obj_id');
554 foreach ($sorted_ids as
$id) {
555 $par = $parent_role_ids[
$id];
557 $output[$key][
"role_id"] = $par[
"obj_id"];
558 $output[$key][
"type"] = ($par[
"type"] ==
'role' ? $this->
lng->txt(
'obj_role') : $this->
lng->txt(
'obj_rolt'));
560 $output[$key][
"role_desc"] = $par[
"desc"];
566 $tbl->setTitle($this->
lng->txt(
"adopt_perm_from_template"));
567 $tbl->setData($output);
569 $this->tpl->setContent($tbl->getHTML());
577 $this->tabs_gui->clearTargets();
579 if (!$this->
checkAccess(
'visible,write',
'edit_permission')) {
580 $this->tpl->setOnScreenMessage(
'msg_no_perm_perm', $this->
lng->txt(
'permission_denied'),
true);
581 $this->
ctrl->redirectByClass(ilRepositoryGUI::class);
584 $question = $this->
lng->txt(
'rbac_role_delete_qst');
585 if ($this->rbac_review->isAssigned($this->user->getId(), $this->object->getId())) {
586 $question .= (
'<br />' . $this->
lng->txt(
'rbac_role_delete_self'));
588 $this->tpl->setOnScreenMessage(
'question', $question);
591 $confirm->setFormAction($this->
ctrl->getFormAction($this));
592 $confirm->setHeaderText($question);
593 $confirm->setCancel($this->
lng->txt(
'cancel'),
'perm');
594 $confirm->setConfirm($this->
lng->txt(
'rbac_delete_role'),
'performDeleteRole');
598 (
string) $this->
object->getId(),
603 $this->tpl->setContent($confirm->getHTML());
611 if (!$this->
checkAccess(
'visible,write',
'edit_permission')) {
612 $this->tpl->setOnScreenMessage(
'msg_no_perm_perm', $this->
lng->txt(
'permission_denied'),
true);
613 $this->
ctrl->redirectByClass(ilRepositoryGUI::class);
616 $this->
object->setParent($this->obj_ref_id);
617 $this->
object->delete();
618 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'msg_deleted_role'),
true);
620 $this->
ctrl->returnToParent($this);
629 if (!$this->
checkAccess(
'visible,write',
'edit_permission')) {
630 $this->tpl->setOnScreenMessage(
'msg_no_perm_perm', $this->
lng->txt(
'permission_denied'),
true);
631 $this->
ctrl->redirectByClass(ilRepositoryGUI::class);
636 if ($rbac_log_active) {
642 if ($a_show_admin_permissions) {
643 $subs = ilObjRole::getSubObjects(
'adm',
true);
645 $subs = ilObjRole::getSubObjects(
'root',
false);
648 $subs = ilObjRole::getSubObjects($this->
getParentType(), $a_show_admin_permissions);
651 foreach (array_keys($subs) as $subtype) {
653 $this->rbac_admin->deleteRolePermission($this->
object->getId(), $this->obj_ref_id, $subtype);
657 foreach ($template_permissions as $key => $ops_array) {
659 $this->rbac_admin->setRolePermission($this->
object->getId(), $key, $ops_array, $this->obj_ref_id);
662 if ($rbac_log_active) {
669 $this->
object->update();
673 if ($this->
http->wrapper()->post()->has(
'protected')) {
674 $protected = $this->
http->wrapper()->post()->retrieve(
681 $this->rbac_review->isAssignable($this->object->getId(), $this->obj_ref_id)) {
682 $this->rbac_admin->setProtected($this->obj_ref_id, $this->
object->getId(),
ilUtil::tf2yn($protected));
685 if ($this->
http->wrapper()->post()->has(
'recursive')) {
686 $recursive = $this->
http->wrapper()->post()->retrieve(
692 $recursive_list = [];
693 if ($this->
http->wrapper()->post()->has(
'recursive_list')) {
694 $recursive_list = $this->
http->wrapper()->post()->retrieve(
696 $this->
refinery->kindlyTo()->listOf(
697 $this->refinery->kindlyTo()->string()
701 if ($a_show_admin_permissions) {
706 if (!$recursive && !count($recursive_list)) {
707 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"saved_successfully"),
true);
708 if ($a_show_admin_permissions) {
709 $this->
ctrl->redirect($this,
'adminPerm');
711 $this->
ctrl->redirect($this,
'perm');
716 ($recursive || count($recursive_list)) &&
718 !$a_show_admin_permissions
725 if ($a_show_admin_permissions) {
726 $start = $this->tree->getParentId($this->obj_ref_id);
730 $this->
object->changeExistingObjects(
737 $this->
object->changeExistingObjects(
744 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"saved_successfully"),
true);
746 if ($a_show_admin_permissions) {
747 $this->
ctrl->redirect($this,
'adminPerm');
749 $this->
ctrl->redirect($this,
'perm');
756 if ($this->
http->wrapper()->post()->has(
'adopt')) {
757 $source = $this->
http->wrapper()->post()->retrieve(
764 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'select_one'));
771 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'msg_no_perm_perm'),
true);
773 if ($this->
object->getId() == $source) {
774 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"msg_perm_adopted_from_itself"),
true);
776 $this->rbac_admin->deleteRolePermission($this->
object->getId(), $this->obj_ref_id);
777 $parentRoles = $this->rbac_review->getParentRoleIds($this->obj_ref_id,
true);
778 $this->rbac_admin->copyRoleTemplatePermissions(
780 $parentRoles[$source][
"parent"],
787 $this->
object->update();
791 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"msg_perm_adopted_from1") .
" '" .
793 $this->lng->txt(
"msg_perm_adopted_from2"),
true);
796 $this->
ctrl->redirect($this,
"perm");
804 if (!$this->
checkAccess(
'edit_userassignment',
'edit_permission')) {
805 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'msg_no_perm_assign_user_to_role'),
true);
808 if (!$this->rbac_review->isAssignable($this->object->getId(), $this->obj_ref_id) &&
810 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'err_role_not_assignable'),
true);
813 if ($a_user_ids === []) {
814 $this->
lng->loadLanguageModule(
'search');
815 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'search_err_user_not_exist'),
true);
819 $assigned_users_all = $this->rbac_review->assignedUsers($this->
object->getId());
822 $assigned_users_new = array_diff($a_user_ids, array_intersect($a_user_ids, $assigned_users_all));
825 if (count($assigned_users_new) == 0) {
826 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"rbac_msg_user_already_assigned"),
true);
827 $this->
ctrl->redirect($this,
'userassignment');
831 foreach ($assigned_users_new as
$user_id) {
833 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'msg_anonymous_cannot_be_assigned'),
true);
836 $this->rbac_admin->assignUser($this->
object->getId(), $user_id,
false);
840 $this->
object->update();
842 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"msg_userassignment_changed"),
true);
843 $this->
ctrl->redirect($this,
'userassignment');
848 if (!$this->
checkAccess(
'edit_userassignment',
'edit_permission')) {
849 $this->
ilias->raiseError(
850 $this->
lng->txt(
"msg_no_perm_assign_user_to_role"),
851 $this->ilias->error_obj->MESSAGE
855 $selected_users = [];
856 if ($this->
http->wrapper()->query()->has(
'user_id')) {
858 $this->
http->wrapper()->query()->retrieve(
864 if ($this->
http->wrapper()->post()->has(
'user_id')) {
865 $selected_users = $this->
http->wrapper()->post()->retrieve(
867 $this->
refinery->kindlyTo()->listOf(
868 $this->refinery->kindlyTo()->int()
872 if (count($selected_users) === 0) {
873 $this->
ilias->raiseError($this->
lng->txt(
"no_checkbox"), $this->ilias->error_obj->MESSAGE);
878 if ($admin = array_search(
SYSTEM_USER_ID, $selected_users) !==
false) {
879 unset($selected_users[$admin]);
885 $global_roles = $this->rbac_review->getGlobalRoles();
886 foreach ($selected_users as
$user) {
887 $assigned_roles = $this->rbac_review->assignedRoles(
$user);
888 $assigned_global_roles = array_intersect($assigned_roles, $global_roles);
890 if (count($assigned_roles) == 1 || count($assigned_global_roles) == 1 && in_array(
892 $assigned_global_roles
895 $last_role[
$user] = $userObj->getFullName();
901 foreach ($selected_users as
$user) {
902 if (!isset($last_role[
$user])) {
903 $this->rbac_admin->deassignUser($this->
object->getId(), $user);
908 $this->
object->update();
911 if ($last_role !== []) {
912 $user_list = implode(
", ", $last_role);
913 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'msg_is_last_role') .
': ' . $user_list .
'<br />' . $this->lng->txt(
'msg_min_one_role'),
true);
915 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"msg_userassignment_changed"),
true);
917 $this->
ctrl->redirect($this,
'userassignment');
925 if (!$this->
checkAccess(
'edit_userassignment',
'edit_permission')) {
926 $this->tpl->setOnScreenMessage(
927 $this->
lng->txt(
"msg_no_perm_assign_user_to_role"),
932 $this->tabs_gui->setTabActive(
'user_assignment');
934 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.rbac_ua.html',
'components/ILIAS/AccessControl');
940 || ($this->rbac_review->isAssigned($this->user->getId(),
SYSTEM_ROLE_ID)
947 'auto_complete_name' => $this->
lng->txt(
'user'),
948 'submit_name' => $this->lng->txt(
'add')
955 $this->ui_factory->link()->standard(
956 $this->lng->txt(
'search_user'),
957 $this->ctrl->getLinkTargetByClass(
'ilRepositorySearchGUI',
'start')
964 $this->ui_factory->link()->standard(
965 $this->lng->txt(
'role_mailto'),
966 $this->ctrl->getLinkTarget($this,
'mailToRole')
969 $this->tpl->setVariable(
'BUTTONS_UA', $tb->getHTML());
971 $role_assignment_editable =
true;
975 $role_assignment_editable =
false;
983 $role_assignment_editable,
984 $this->getAdminMode() === self::ADMIN_MODE_SETTINGS
986 $this->tpl->setVariable(
'TABLE_UA', $ut->getHTML());
994 if ($this->
getAdminMode() === self::ADMIN_MODE_SETTINGS) {
995 parent::addAdminLocatorItems(
true);
998 $this->
lng->txt(
'obj_' . $this->getParentType()),
999 $this->ctrl->getLinkTargetByClass(
"ilobjrolefoldergui",
'view')
1002 if ($this->
object instanceof
ilObjRole) {
1005 $this->ctrl->getLinkTarget($this,
'perm')
1009 parent::addAdminLocatorItems($do_not_add_object);
1015 $base_role_container = $this->rbac_review->getFoldersAssignedToRole($this->
object->getId(),
true);
1016 $activate_role_edit =
false;
1021 in_array($this->obj_ref_id, $base_role_container) ||
1024 $activate_role_edit =
true;
1028 $this->tabs_gui->clearTargets();
1030 $this->
help->setScreenIdComponent(
'role');
1031 $this->tabs_gui->setBackTarget(
1032 $this->
lng->txt(
'btn_back'),
1033 (
string) $this->ctrl->getParentReturn($this)
1035 if ($this->
checkAccess(
'write',
'edit_permission') && $activate_role_edit) {
1036 $this->tabs_gui->addTarget(
1038 $this->
ctrl->getLinkTarget($this,
"edit"),
1044 $this->tabs_gui->addTarget(
1045 'default_perm_settings',
1046 $this->
ctrl->getLinkTarget($this,
'perm'),
1056 $this->tabs_gui->addTarget(
1058 $this->
ctrl->getLinkTarget($this,
'userassignment'),
1059 [
'deassignUser',
'userassignment',
'assignUser',
'searchUserForm',
'search'],
1068 $this->
lng->loadLanguageModule(
'rep');
1069 $this->tabs_gui->addTarget(
1070 'rep_recommended_content',
1071 $this->
ctrl->getLinkTargetByClass(
'ilrecommendedcontentroleconfiggui',
'')
1074 if ($this->
checkAccess(
'write',
'edit_permission')) {
1075 $this->tabs_gui->addTarget(
1077 $this->
ctrl->getLinkTargetByClass(
'ilExportGUI'),
1088 if (count($obj_ids) > 1) {
1089 $mail_roles[] =
'#il_role_' . $this->
object->getId();
1091 $mail_roles[] = (new \ilRoleMailboxAddress($this->
object->getId()))->value();
1098 public function checkAccess(
string $a_perm_global,
string $a_perm_obj =
''): bool
1100 $a_perm_obj = $a_perm_obj ?: $a_perm_global;
1103 return $this->rbac_system->checkAccess($a_perm_global, $this->obj_ref_id);
1105 return $this->
access->checkAccess($a_perm_obj,
'', $this->obj_ref_id);
1115 if ($this->rbac_review->isProtected($this->obj_ref_id, $this->object->getId())) {
1118 return count($this->rbac_review->getFoldersAssignedToRole($this->object->getId())) > 1;
1122 return count($this->rbac_review->getFoldersAssignedToRole($this->object->getId())) > 1;
1133 if ($this->
http->wrapper()->post()->has(
'protected')) {
1134 $protected = $this->
http->wrapper()->post()->retrieve(
1136 $this->
refinery->kindlyTo()->bool()
1140 $form->setFormAction($this->
ctrl->getFormAction($this,
'changeExistingObjects'));
1141 $form->setTitle($this->
lng->txt(
'rbac_change_existing_confirm_tbl'));
1143 $form->addCommandButton(
'changeExistingObjects', $this->
lng->txt(
'change_existing_objects'));
1144 $form->addCommandButton(
'perm', $this->
lng->txt(
'cancel'));
1147 $hidden->setValue($recursive ? json_encode([
'all']) : json_encode($recursive_list));
1148 $form->addItem($hidden);
1155 $this->
lng->txt(
'rbac_keep_local_policies'),
1157 $this->lng->txt(
'rbac_keep_local_policies_info')
1162 $this->
lng->txt(
'rbac_keep_local_policies'),
1163 (
string) ilObjRole::MODE_UNPROTECTED_KEEP_LOCAL_POLICIES,
1164 $this->lng->txt(
'rbac_unprotected_keep_local_policies_info')
1167 $rad->addOption($keep);
1171 $this->
lng->txt(
'rbac_delete_local_policies'),
1173 $this->lng->txt(
'rbac_delete_local_policies_info')
1177 $this->
lng->txt(
'rbac_delete_local_policies'),
1179 $this->lng->txt(
'rbac_unprotected_delete_local_policies_info')
1182 $rad->addOption($del);
1184 $form->addItem($rad);
1185 $this->tpl->setContent($form->getHTML());
1191 if ($this->
http->wrapper()->post()->has(
'mode')) {
1192 $mode = $this->
http->wrapper()->post()->retrieve(
1200 if ($this->
http->wrapper()->post()->has(
'type_filter')) {
1201 $serialized_type_filter = $this->
http->wrapper()->post()->retrieve(
1203 $this->
refinery->kindlyTo()->string()
1205 $type_filter = json_decode(
1206 $serialized_type_filter,
1211 $this->
object->changeExistingObjects($start, $mode, $type_filter);
1212 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
1213 $this->
ctrl->redirect($this,
'perm');
1219 case 'default_perm_settings':
1223 $this->tabs_gui->addSubTabTarget(
1224 'rbac_repository_permissions',
1225 $this->
ctrl->getLinkTarget($this,
'perm')
1227 $this->tabs_gui->addSubTabTarget(
1228 'rbac_admin_permissions',
1229 $this->
ctrl->getLinkTarget($this,
'adminPerm')
1240 if ($this->
http->wrapper()->post()->has(
'user_id')) {
1241 $users = $this->
http->wrapper()->post()->retrieve(
1243 $this->
refinery->kindlyTo()->listOf(
1244 $this->refinery->kindlyTo()->int()
1248 if (count($users) === 0) {
1249 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'select_one'),
true);
1250 $this->
ctrl->redirect($this,
'userassignment');
1256 $this->
lng->loadLanguageModule(
'user');
1257 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'clipboard_user_added'),
true);
1258 $this->
ctrl->redirect($this,
'userassignment');
1267 $this->
ctrl->setParameterByClass(
1274 $this->ctrl->getLinkTargetByClass(
1293 !$this->
object->getId() ||
1299 $possible_roles = [];
1301 $possible_roles = $this->rbac_review->getRolesOfObject(
1305 }
catch (\InvalidArgumentException
$e) {
1306 $this->
logger->warning(
'Role access check failed: ' . $e);
1307 throw new \ilObjectException($this->
lng->txt(
'permission_denied'));
1310 if (!in_array($this->
object->getId(), $possible_roles)) {
1311 $this->
logger->warning(
'Object id: ' . $this->
object->getId() .
' is not accessible for ref_id: ' . $this->obj_ref_id);
1312 throw new \ilObjectException($this->
lng->txt(
'permission_denied'));
1319 $message = $this->
lng->txt(
'rbac_role_delete_qst');
1320 if ($this->rbac_review->isAssigned($this->user->getId(), $this->object->getId())) {
1321 $message .= (
'<br />' . $this->
lng->txt(
'rbac_role_delete_self'));
1323 return $this->ui_factory->modal()->interruptive(
1324 $this->
lng->txt(
'confirm'),
1326 $this->
ctrl->getFormActionByClass(self::class,
'performDeleteRole')
1327 )->withAffectedItems([
1328 $this->ui_factory->modal()->interruptiveItem()->standard(
1329 (
string) $this->
object->getId(),
1330 $this->object->getTitle()
Builds a Color from either hex- or rgb values.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
TableGUI class for role administration.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Export User Interface Class.
static newInstance(int $a_export_id)
static allocateExportId()
Component logger with individual log levels by component id.
getAdminTabs()
admin and normal tabs are equal for roles
showChangeExistingObjectsConfirmation(bool $recursive, array $recursive_list)
Show confirmation screen.
getTabs()
@abstract overwrite in derived GUI class of your object type
permObject(bool $a_show_admin_permissions=false)
performDeleteRoleObject()
Delete role.
getRoleForm(bool $is_role_creation_form=false)
saveObject()
Save new role.
const FORM_KEY_ALLOW_LOCAL_USER_ASSIGNMENT
addAdminLocatorItems(bool $do_not_add_object=false)
should be overwritten to add object specific items (repository items are preloaded)
updateObject()
Save role settings.
const FORM_KEY_DESCRIPTION
userassignmentObject()
display user assignment panel
const FORM_KEY_ON_REGISTRATION_FORM
ensureRoleAccessForContext()
Ensure access to role for ref_id.
addLocatorItems()
should be overwritten to add object specific items (repository items are preloaded)
retrieveTemplatePermissionsFromPost()
getParentType()
get type of current object (not role folder)
getContainerType()
Get type of role container.
addUserObject(array $a_user_ids)
buildEditPage(?StandardForm $form=null)
showDefaultPermissionSettings()
check if default permissions are shown or not
checkAccess(string $a_perm_global, string $a_perm_obj='')
confirmDeleteRoleObject()
Show delete confirmation screen.
createObject()
create new object form
getParentRefId()
Get ref id of current object (not role folder id)
isChangeExistingObjectsConfirmationRequired()
Check if a confirmation about further settings is required or not.
permSaveObject(bool $a_show_admin_permissions=false)
save permissions @access public
getParentObjId()
Get obj_id of current object.
addToClipboardObject()
Add selected users to user clipboard.
changeExistingObjectsObject()
const MODE_UNPROTECTED_KEEP_LOCAL_POLICIES
const MODE_PROTECTED_DELETE_LOCAL_POLICIES
const MODE_UNPROTECTED_DELETE_LOCAL_POLICIES
const MODE_PROTECTED_KEEP_LOCAL_POLICIES
static _getTranslation(string $a_role_title)
Class ilObjectGUI Basic methods of all Output classes.
prepareOutput(bool $show_sub_objects=true)
Table for object role permissions.
Table for object role permissions.
static _lookupType(int $id, bool $reference=false)
static _getIdsForTitle(string $title, string $type='', bool $partial_match=false)
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
This class represents an option in a radio group.
static diffTemplate(array $old, array $new)
static add(int $action, int $ref_id, array $diff, bool $source_ref_id=false)
static gatherTemplate(int $role_ref_id, int $role_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static fillAutoCompleteToolbar(object $parent_object, ?ilToolbarGUI $toolbar=null, array $a_options=[], bool $a_sticky=false)
array( auto_complete_name = $lng->txt('user'), auto_complete_size = 15, user_type = array(ilCoursePar...
Copy Permission Settings.
static _getInstance()
Get instance of ilSecuritySettings.
static get(string $a_var)
static set(string $a_var, $a_val)
Set a value.
static getInstance(int $a_usr_id)
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
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,...
static redirect(string $a_script)
const SYSTEM_USER_ID
This file contains constants for PHPStan analyis, see: https://phpstan.org/config-reference#constants...
An entity that renders components to a string output.
static http()
Fetches the global http state from ILIAS.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
Class ilObjForumAdministration.