19 declare(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 $exp->addFormat(
'xml');
122 $this->
ctrl->forwardCommand($exp);
125 case 'ilrecommendedcontentroleconfiggui':
126 $this->tabs_gui->setTabActive(
'rep_recommended_content');
128 $this->
ctrl->forwardCommand($ui);
136 $cmd =
'userassignment';
153 $this->obj_ref_id = 0;
155 if ($this->
http->wrapper()->query()->has(
'rolf_ref_id')) {
156 $this->obj_ref_id = $this->
http->wrapper()->query()->retrieve(
160 } elseif ($this->
http->wrapper()->query()->has(
'ref_id')) {
161 $this->obj_ref_id = $this->
http->wrapper()->query()->retrieve(
170 $template_permissions = [];
171 if ($this->
http->wrapper()->post()->has(
'template_perm')) {
172 $custom_transformer = $this->
refinery->custom()->transformation(
177 $template_permissions = $this->
http->wrapper()->post()->retrieve(
182 return $template_permissions;
231 || $this->obj_definition->isAdministrationObject($this->
getContainerType());
236 if ($this->creation_mode) {
237 $this->
ctrl->setParameter($this,
'new_type',
'role');
240 $ff = $this->ui_factory->input()->field();
242 $title_validation_constraint = $this->
refinery->custom()->constraint(
243 fn(
string $v):
bool => preg_match(
'/^il_.*$/', $v) ?
false :
true,
244 $this->
lng->txt(
'msg_role_reserved_prefix')
247 $role_is_autogenerated =
false;
249 if (!$is_role_creation_form) {
250 $role_is_autogenerated = $this->
object->isAutoGenerated();
254 self::FORM_KEY_TITLE => $ff->text($this->
lng->txt(
'title'))
257 ->withAdditionalTransformation($title_validation_constraint)
258 ->withValue($is_role_creation_form ?
'' : $this->
object->getTitle())
259 ->withDisabled($role_is_autogenerated),
260 self::FORM_KEY_DESCRIPTION => $ff->textarea($this->
lng->txt(
'description'))
262 ->withValue($is_role_creation_form ?
'' : $this->
object->getDescription())
263 ->withDisabled($role_is_autogenerated),
267 if (!$is_role_creation_form) {
268 $inputs[self::FORM_KEY_ILIAS_ID] = $ff->text($this->
lng->txt(
'ilias_id'))
271 . $this->
object->getType() .
'_' . $this->
object->getId());
275 $inputs[self::FORM_KEY_ON_REGISTRATION_FORM] = $ff->checkbox($this->
lng->txt(
'allow_register'))
276 ->
withValue($is_role_creation_form ?
false : $this->
object->getAllowRegister());
277 $inputs[self::FORM_KEY_ALLOW_LOCAL_USER_ASSIGNMENT] = $ff->checkbox($this->
lng->txt(
'allow_assign_users'))
278 ->
withValue($is_role_creation_form ?
false : $this->
object->getAssignUsersStatus());
281 $inputs[self::FORM_KEY_PROTECT] = $ff->checkbox($this->
lng->txt(
'role_protect_permissions'))
283 $is_role_creation_form
285 : $this->rbac_review->isProtected($this->obj_ref_id, $this->object->getId())
288 return $this->ui_factory->input()->container()->form()->standard(
289 $this->
ctrl->getFormActionByClass(
291 $is_role_creation_form ?
'save' :
'update' 295 $is_role_creation_form ? $this->
lng->txt(
'role_new') : $this->
lng->txt(
'save')
301 if (!$this->rbac_system->checkAccess(
'create_role', $this->obj_ref_id)) {
302 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'permission_denied'),
true);
303 $this->
ctrl->returnToParent(ilRepositoryGUI::class);
306 $this->tabs_gui->setBackTarget(
307 $this->
lng->txt(
'cancel'),
308 $this->
ctrl->getParentReturnByClass(self::class)
311 $this->tpl->setContent(
312 $this->ui_renderer->render(
313 $this->ui_factory->panel()->standard(
314 $this->
lng->txt(
'role_new'),
323 if (!$this->
checkAccess(
'write',
'edit_permission')) {
324 $this->tpl->setOnScreenMessage(
'msg_no_perm_write', $this->
lng->txt(
'permission_denied'),
true);
325 $this->
ctrl->returnToParent($this);
327 $this->tabs_gui->activateTab(
'edit_properties');
338 $form = $this->
getRoleForm(
true)->withRequest($this->request);
339 $data = $form->getData();
341 $this->tabs_gui->setBackTarget(
342 $this->
lng->txt(
'cancel'),
343 $this->
ctrl->getParentReturnByClass(self::class)
345 $this->tpl->setContent(
346 $this->ui_renderer->render(
347 $this->ui_factory->panel()->standard(
348 $this->
lng->txt(
'role_new'),
357 $role->setTitle(
$data[self::FORM_KEY_TITLE]);
358 $role->setDescription(
$data[self::FORM_KEY_DESCRIPTION]);
359 $role->setAllowRegister(
$data[self::FORM_KEY_ON_REGISTRATION_FORM]);
360 $role->toggleAssignUsersStatus(
$data[self::FORM_KEY_ALLOW_LOCAL_USER_ASSIGNMENT]);
363 $this->rbac_admin->setProtected(
366 $data[self::FORM_KEY_PROTECT] ?
'y' :
'n' 368 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'role_added'),
true);
369 $this->
ctrl->setParameter($this,
'obj_id', $role->getId());
370 $this->
ctrl->redirect($this,
'perm');
379 $form = $this->
getRoleForm()->withRequest($this->request);
380 $data = $form->getData();
386 if (isset(
$data[self::FORM_KEY_TITLE])) {
387 $this->
object->setTitle(
$data[self::FORM_KEY_TITLE]);
389 if (isset(
$data[self::FORM_KEY_DESCRIPTION])) {
390 $this->
object->setDescription(
$data[self::FORM_KEY_DESCRIPTION]);
392 if (isset(
$data[self::FORM_KEY_ON_REGISTRATION_FORM])) {
393 $this->
object->setAllowRegister(
$data[self::FORM_KEY_ON_REGISTRATION_FORM]);
395 if (isset(
$data[self::FORM_KEY_ALLOW_LOCAL_USER_ASSIGNMENT])) {
396 $this->
object->toggleAssignUsersStatus(
$data[self::FORM_KEY_ALLOW_LOCAL_USER_ASSIGNMENT]);
398 $this->
object->update();
399 $this->rbac_admin->setProtected(
402 $data[self::FORM_KEY_PROTECT] ?
'y' :
'n' 405 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'saved_successfully'),
true);
406 $this->
ctrl->redirect($this,
'edit');
413 $this->
toolbar->setFormAction($this->
ctrl->getFormAction($this));
414 if ($this->rbac_review->isDeleteable($this->object->getId(),
$this->obj_ref_id)) {
417 $this->ui_factory->button()->standard(
418 $this->
lng->txt(
'rbac_delete_role'),
419 $modal->getShowSignal()
422 $page_content[] = $modal;
426 $page_content[] = $this->ui_factory->panel()->standard(
427 $this->
lng->txt(
'role_edit'),
431 $this->tpl->setContent(
432 $this->ui_renderer->render($page_content)
436 protected function permObject(
bool $a_show_admin_permissions =
false): void
438 $this->tabs_gui->setTabActive(
'default_perm_settings');
442 if (!$this->
checkAccess(
'write',
'edit_permission')) {
443 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'msg_no_perm_write'),
true);
444 $this->
ctrl->returnToParent($this);
447 if ($a_show_admin_permissions) {
448 $this->tabs_gui->setSubTabActive(
'rbac_admin_permissions');
450 $this->tabs_gui->setSubTabActive(
'rbac_repository_permissions');
453 $this->tpl->addBlockFile(
456 'tpl.rbac_template_permissions.html',
457 'components/ILIAS/AccessControl' 461 $this->
toolbar->setFormAction($this->
ctrl->getFormAction($this));
463 $this->ui_factory->link()->standard(
464 $this->
lng->txt(
"adopt_perm_from_template"),
465 $this->
ctrl->getLinkTarget($this,
'adoptPerm')
468 if ($this->rbac_review->isDeleteable($this->object->getId(),
$this->obj_ref_id)) {
471 $this->ui_factory->button()->standard(
472 $this->
lng->txt(
'rbac_delete_role'),
473 $modal->getShowSignal()
476 $this->tpl->setVariable(
'DELETION_MODAL', $this->ui_renderer->render($modal));
480 $this->tpl->setVariable(
'PERM_ACTION', $this->
ctrl->getFormAction($this));
487 if ($a_show_admin_permissions) {
488 $subs = ilObjRole::getSubObjects(
'adm',
true);
490 $subs = ilObjRole::getSubObjects(
'root',
false);
493 $subs = ilObjRole::getSubObjects($this->
getParentType(), $a_show_admin_permissions);
496 foreach ($subs as $subtype => $def) {
503 $a_show_admin_permissions
507 $acc->addItem($def[
'translation'], $tbl->getHTML());
510 $this->tpl->setVariable(
'ACCORDION', $acc->getHTML());
518 $a_show_admin_permissions
522 $a_show_admin_permissions ?
'adminPermSave' :
'permSave',
523 $this->
lng->txt(
'save')
528 $this->tpl->setVariable(
'OPTIONS_TABLE', $options->getHTML());
544 $parent_role_ids = $this->rbac_review->getParentRoleIds($this->obj_ref_id,
true);
546 $this->tabs_gui->clearTargets();
549 foreach (array_keys($parent_role_ids) as
$id) {
553 $sorted_ids =
ilUtil::_sortIds($ids,
'object_data',
'type,title',
'obj_id');
555 foreach ($sorted_ids as $id) {
556 $par = $parent_role_ids[
$id];
558 $output[$key][
"role_id"] = $par[
"obj_id"];
559 $output[$key][
"type"] = ($par[
"type"] ==
'role' ? $this->
lng->txt(
'obj_role') : $this->
lng->txt(
'obj_rolt'));
561 $output[$key][
"role_desc"] = $par[
"desc"];
567 $tbl->setTitle($this->
lng->txt(
"adopt_perm_from_template"));
568 $tbl->setData($output);
570 $this->tpl->setContent($tbl->getHTML());
578 $this->tabs_gui->clearTargets();
580 if (!$this->
checkAccess(
'visible,write',
'edit_permission')) {
581 $this->tpl->setOnScreenMessage(
'msg_no_perm_perm', $this->
lng->txt(
'permission_denied'),
true);
582 $this->
ctrl->redirectByClass(ilRepositoryGUI::class);
585 $question = $this->
lng->txt(
'rbac_role_delete_qst');
586 if ($this->rbac_review->isAssigned($this->user->getId(), $this->
object->getId())) {
587 $question .= (
'<br />' . $this->
lng->txt(
'rbac_role_delete_self'));
589 $this->tpl->setOnScreenMessage(
'question', $question);
592 $confirm->setFormAction($this->
ctrl->getFormAction($this));
593 $confirm->setHeaderText($question);
594 $confirm->setCancel($this->
lng->txt(
'cancel'),
'perm');
595 $confirm->setConfirm($this->
lng->txt(
'rbac_delete_role'),
'performDeleteRole');
599 (
string) $this->
object->getId(),
604 $this->tpl->setContent($confirm->getHTML());
612 if (!$this->
checkAccess(
'visible,write',
'edit_permission')) {
613 $this->tpl->setOnScreenMessage(
'msg_no_perm_perm', $this->
lng->txt(
'permission_denied'),
true);
614 $this->
ctrl->redirectByClass(ilRepositoryGUI::class);
617 $this->
object->setParent($this->obj_ref_id);
618 $this->
object->delete();
619 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'msg_deleted_role'),
true);
621 $this->
ctrl->returnToParent($this);
630 if (!$this->
checkAccess(
'visible,write',
'edit_permission')) {
631 $this->tpl->setOnScreenMessage(
'msg_no_perm_perm', $this->
lng->txt(
'permission_denied'),
true);
632 $this->
ctrl->redirectByClass(ilRepositoryGUI::class);
637 if ($rbac_log_active) {
643 if ($a_show_admin_permissions) {
644 $subs = ilObjRole::getSubObjects(
'adm',
true);
646 $subs = ilObjRole::getSubObjects(
'root',
false);
649 $subs = ilObjRole::getSubObjects($this->
getParentType(), $a_show_admin_permissions);
652 foreach (array_keys($subs) as $subtype) {
658 foreach ($template_permissions as $key => $ops_array) {
663 if ($rbac_log_active) {
670 $this->
object->update();
674 if ($this->
http->wrapper()->post()->has(
'protected')) {
675 $protected = $this->
http->wrapper()->post()->retrieve(
683 $this->rbac_admin->setProtected($this->obj_ref_id, $this->
object->getId(),
ilUtil::tf2yn($protected));
686 if ($this->
http->wrapper()->post()->has(
'recursive')) {
687 $recursive = $this->
http->wrapper()->post()->retrieve(
693 $recursive_list = [];
694 if ($this->
http->wrapper()->post()->has(
'recursive_list')) {
695 $recursive_list = $this->
http->wrapper()->post()->retrieve(
697 $this->
refinery->kindlyTo()->listOf(
698 $this->
refinery->kindlyTo()->string()
702 if ($a_show_admin_permissions) {
707 if (!$recursive && !count($recursive_list)) {
708 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"saved_successfully"),
true);
709 if ($a_show_admin_permissions) {
710 $this->
ctrl->redirect($this,
'adminPerm');
712 $this->
ctrl->redirect($this,
'perm');
717 ($recursive || count($recursive_list)) &&
719 !$a_show_admin_permissions
726 if ($a_show_admin_permissions) {
727 $start = $this->tree->getParentId($this->obj_ref_id);
731 $this->
object->changeExistingObjects(
738 $this->
object->changeExistingObjects(
745 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"saved_successfully"),
true);
747 if ($a_show_admin_permissions) {
748 $this->
ctrl->redirect($this,
'adminPerm');
750 $this->
ctrl->redirect($this,
'perm');
757 if ($this->
http->wrapper()->post()->has(
'adopt')) {
758 $source = $this->
http->wrapper()->post()->retrieve(
765 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'select_one'));
772 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'msg_no_perm_perm'),
true);
774 if ($this->
object->getId() == $source) {
775 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"msg_perm_adopted_from_itself"),
true);
778 $parentRoles = $this->rbac_review->getParentRoleIds($this->obj_ref_id,
true);
779 $this->rbac_admin->copyRoleTemplatePermissions(
781 $parentRoles[$source][
"parent"],
788 $this->
object->update();
792 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"msg_perm_adopted_from1") .
" '" .
794 $this->
lng->txt(
"msg_perm_adopted_from2"),
true);
797 $this->
ctrl->redirect($this,
"perm");
805 if (!$this->
checkAccess(
'edit_userassignment',
'edit_permission')) {
806 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'msg_no_perm_assign_user_to_role'),
true);
809 if (!$this->rbac_review->isAssignable($this->object->getId(),
$this->obj_ref_id) &&
811 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'err_role_not_assignable'),
true);
814 if ($a_user_ids === []) {
815 $this->
lng->loadLanguageModule(
'search');
816 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'search_err_user_not_exist'),
true);
820 $assigned_users_all = $this->rbac_review->assignedUsers($this->
object->getId());
823 $assigned_users_new = array_diff($a_user_ids, array_intersect($a_user_ids, $assigned_users_all));
826 if (count($assigned_users_new) == 0) {
827 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"rbac_msg_user_already_assigned"),
true);
828 $this->
ctrl->redirect($this,
'userassignment');
832 foreach ($assigned_users_new as
$user_id) {
834 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'msg_anonymous_cannot_be_assigned'),
true);
837 $this->rbac_admin->assignUser($this->
object->getId(),
$user_id,
false);
841 $this->
object->update();
843 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"msg_userassignment_changed"),
true);
844 $this->
ctrl->redirect($this,
'userassignment');
849 if (!$this->
checkAccess(
'edit_userassignment',
'edit_permission')) {
850 $this->
ilias->raiseError(
851 $this->
lng->txt(
"msg_no_perm_assign_user_to_role"),
852 $this->
ilias->error_obj->MESSAGE
856 $selected_users = [];
857 if ($this->
http->wrapper()->query()->has(
'user_id')) {
859 $this->
http->wrapper()->query()->retrieve(
865 if ($this->
http->wrapper()->post()->has(
'user_id')) {
866 $selected_users = $this->
http->wrapper()->post()->retrieve(
868 $this->
refinery->kindlyTo()->listOf(
873 if (count($selected_users) === 0) {
874 $this->
ilias->raiseError($this->
lng->txt(
"no_checkbox"), $this->
ilias->error_obj->MESSAGE);
879 if ($admin = array_search(
SYSTEM_USER_ID, $selected_users) !==
false) {
880 unset($selected_users[$admin]);
886 $global_roles = $this->rbac_review->getGlobalRoles();
887 foreach ($selected_users as
$user) {
888 $assigned_roles = $this->rbac_review->assignedRoles($user);
889 $assigned_global_roles = array_intersect($assigned_roles, $global_roles);
891 if (count($assigned_roles) == 1 || count($assigned_global_roles) == 1 && in_array(
893 $assigned_global_roles
896 $last_role[
$user] = $userObj->getFullName();
902 foreach ($selected_users as $user) {
903 if (!isset($last_role[$user])) {
904 $this->rbac_admin->deassignUser($this->
object->getId(),
$user);
909 $this->
object->update();
912 if ($last_role !== []) {
913 $user_list = implode(
", ", $last_role);
914 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'msg_is_last_role') .
': ' . $user_list .
'<br />' . $this->
lng->txt(
'msg_min_one_role'),
true);
916 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"msg_userassignment_changed"),
true);
918 $this->
ctrl->redirect($this,
'userassignment');
926 if (!$this->
checkAccess(
'edit_userassignment',
'edit_permission')) {
927 $this->tpl->setOnScreenMessage(
928 $this->
lng->txt(
"msg_no_perm_assign_user_to_role"),
933 $this->tabs_gui->setTabActive(
'user_assignment');
935 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.rbac_ua.html',
'components/ILIAS/AccessControl');
948 'auto_complete_name' => $this->
lng->txt(
'user'),
949 'submit_name' => $this->
lng->txt(
'add')
956 $this->ui_factory->link()->standard(
957 $this->
lng->txt(
'search_user'),
958 $this->
ctrl->getLinkTargetByClass(
'ilRepositorySearchGUI',
'start')
965 $this->ui_factory->link()->standard(
966 $this->
lng->txt(
'role_mailto'),
967 $this->
ctrl->getLinkTarget($this,
'mailToRole')
970 $this->tpl->setVariable(
'BUTTONS_UA', $tb->getHTML());
972 $role_assignment_editable =
true;
976 $role_assignment_editable =
false;
984 $role_assignment_editable,
987 $this->tpl->setVariable(
'TABLE_UA', $ut->getHTML());
995 if ($this->
getAdminMode() === self::ADMIN_MODE_SETTINGS) {
996 parent::addAdminLocatorItems(
true);
999 $this->
lng->txt(
'obj_' . $this->getParentType()),
1000 $this->
ctrl->getLinkTargetByClass(
"ilobjrolefoldergui",
'view')
1003 if ($this->
object instanceof
ilObjRole) {
1006 $this->
ctrl->getLinkTarget($this,
'perm')
1010 parent::addAdminLocatorItems($do_not_add_object);
1016 $base_role_container = $this->rbac_review->getFoldersAssignedToRole($this->
object->getId(),
true);
1017 $activate_role_edit =
false;
1022 in_array($this->obj_ref_id, $base_role_container) ||
1025 $activate_role_edit =
true;
1029 $this->tabs_gui->clearTargets();
1031 $this->
help->setScreenIdComponent(
'role');
1032 $this->tabs_gui->setBackTarget(
1033 $this->
lng->txt(
'btn_back'),
1034 (string) $this->
ctrl->getParentReturn($this)
1036 if ($this->
checkAccess(
'write',
'edit_permission') && $activate_role_edit) {
1037 $this->tabs_gui->addTarget(
1039 $this->
ctrl->getLinkTarget($this,
"edit"),
1045 $this->tabs_gui->addTarget(
1046 'default_perm_settings',
1047 $this->
ctrl->getLinkTarget($this,
'perm'),
1057 $this->tabs_gui->addTarget(
1059 $this->
ctrl->getLinkTarget($this,
'userassignment'),
1060 [
'deassignUser',
'userassignment',
'assignUser',
'searchUserForm',
'search'],
1069 $this->
lng->loadLanguageModule(
'rep');
1070 $this->tabs_gui->addTarget(
1071 'rep_recommended_content',
1072 $this->
ctrl->getLinkTargetByClass(
'ilrecommendedcontentroleconfiggui',
'')
1075 if ($this->
checkAccess(
'write',
'edit_permission')) {
1076 $this->tabs_gui->addTarget(
1078 $this->
ctrl->getLinkTargetByClass(
'ilExportGUI'),
1089 if (count($obj_ids) > 1) {
1090 $mail_roles[] =
'#il_role_' . $this->
object->getId();
1092 $mail_roles[] = (new \ilRoleMailboxAddress($this->
object->getId()))->value();
1099 public function checkAccess(
string $a_perm_global,
string $a_perm_obj =
''): bool
1101 $a_perm_obj = $a_perm_obj ?: $a_perm_global;
1104 return $this->rbac_system->checkAccess($a_perm_global, $this->obj_ref_id);
1106 return $this->
access->checkAccess($a_perm_obj,
'', $this->obj_ref_id);
1116 if ($this->rbac_review->isProtected($this->obj_ref_id, $this->object->getId())) {
1119 return count($this->rbac_review->getFoldersAssignedToRole($this->object->getId())) > 1;
1123 return count($this->rbac_review->getFoldersAssignedToRole($this->object->getId())) > 1;
1134 if ($this->
http->wrapper()->post()->has(
'protected')) {
1135 $protected = $this->
http->wrapper()->post()->retrieve(
1137 $this->
refinery->kindlyTo()->bool()
1141 $form->setFormAction($this->
ctrl->getFormAction($this,
'changeExistingObjects'));
1142 $form->setTitle($this->
lng->txt(
'rbac_change_existing_confirm_tbl'));
1144 $form->addCommandButton(
'changeExistingObjects', $this->
lng->txt(
'change_existing_objects'));
1145 $form->addCommandButton(
'perm', $this->
lng->txt(
'cancel'));
1148 $hidden->setValue($recursive ? json_encode([
'all']) : json_encode($recursive_list));
1149 $form->addItem($hidden);
1156 $this->
lng->txt(
'rbac_keep_local_policies'),
1158 $this->
lng->txt(
'rbac_keep_local_policies_info')
1163 $this->
lng->txt(
'rbac_keep_local_policies'),
1164 (string) ilObjRole::MODE_UNPROTECTED_KEEP_LOCAL_POLICIES,
1165 $this->
lng->txt(
'rbac_unprotected_keep_local_policies_info')
1168 $rad->addOption($keep);
1172 $this->
lng->txt(
'rbac_delete_local_policies'),
1174 $this->
lng->txt(
'rbac_delete_local_policies_info')
1178 $this->
lng->txt(
'rbac_delete_local_policies'),
1180 $this->
lng->txt(
'rbac_unprotected_delete_local_policies_info')
1183 $rad->addOption($del);
1185 $form->addItem($rad);
1186 $this->tpl->setContent($form->getHTML());
1192 if ($this->
http->wrapper()->post()->has(
'mode')) {
1193 $mode = $this->
http->wrapper()->post()->retrieve(
1201 if ($this->
http->wrapper()->post()->has(
'type_filter')) {
1202 $serialized_type_filter = $this->
http->wrapper()->post()->retrieve(
1204 $this->
refinery->kindlyTo()->string()
1206 $type_filter = json_decode(
1207 $serialized_type_filter,
1212 $this->
object->changeExistingObjects($start, $mode, $type_filter);
1213 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
1214 $this->
ctrl->redirect($this,
'perm');
1220 case 'default_perm_settings':
1224 $this->tabs_gui->addSubTabTarget(
1225 'rbac_repository_permissions',
1226 $this->
ctrl->getLinkTarget($this,
'perm')
1228 $this->tabs_gui->addSubTabTarget(
1229 'rbac_admin_permissions',
1230 $this->
ctrl->getLinkTarget($this,
'adminPerm')
1241 if ($this->
http->wrapper()->post()->has(
'user_id')) {
1242 $users = $this->
http->wrapper()->post()->retrieve(
1244 $this->
refinery->kindlyTo()->listOf(
1249 if (count($users) === 0) {
1250 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'select_one'),
true);
1251 $this->
ctrl->redirect($this,
'userassignment');
1257 $this->
lng->loadLanguageModule(
'user');
1258 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'clipboard_user_added'),
true);
1259 $this->
ctrl->redirect($this,
'userassignment');
1268 $this->
ctrl->setParameterByClass(
1275 $this->
ctrl->getLinkTargetByClass(
1294 !$this->
object->getId() ||
1300 $possible_roles = [];
1302 $possible_roles = $this->rbac_review->getRolesOfObject(
1307 $this->
logger->warning(
'Role access check failed: ' . $e);
1308 throw new \ilObjectException($this->
lng->txt(
'permission_denied'));
1311 if (!in_array($this->
object->getId(), $possible_roles)) {
1313 throw new \ilObjectException($this->
lng->txt(
'permission_denied'));
1320 $message = $this->
lng->txt(
'rbac_role_delete_qst');
1321 if ($this->rbac_review->isAssigned($this->user->getId(), $this->
object->getId())) {
1322 $message .= (
'<br />' . $this->
lng->txt(
'rbac_role_delete_self'));
1324 return $this->ui_factory->modal()->interruptive(
1325 $this->
lng->txt(
'confirm'),
1327 $this->
ctrl->getFormActionByClass(self::class,
'performDeleteRole')
1328 )->withAffectedItems([
1329 $this->ui_factory->modal()->interruptiveItem()->standard(
1330 (
string) $this->
object->getId(),
1331 $this->
object->getTitle()
static get(string $a_var)
This class represents an option in a radio group.
getRoleForm(bool $is_role_creation_form=false)
Copy Permission Settings.
addToClipboardObject()
Add selected users to user clipboard.
const FORM_KEY_DESCRIPTION
Table for object role permissions.
prepareOutput(bool $show_sub_objects=true)
const MODE_PROTECTED_DELETE_LOCAL_POLICIES
static newInstance(int $a_export_id)
const SYSTEM_USER_ID
This file contains constants for PHPStan analyis, see: https://phpstan.org/config-reference#constants...
addUserObject(array $a_user_ids)
checkAccess(string $a_perm_global, string $a_perm_obj='')
ensureRoleAccessForContext()
Ensure access to role for ref_id.
showChangeExistingObjectsConfirmation(bool $recursive, array $recursive_list)
Show confirmation screen.
parse()
Parse permissions.
Table for object role permissions.
const MODE_PROTECTED_KEEP_LOCAL_POLICIES
static _lookupObjId(int $ref_id)
permSaveObject(bool $a_show_admin_permissions=false)
save permissions public
permObject(bool $a_show_admin_permissions=false)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
saveObject()
Save new role.
retrieveTemplatePermissionsFromPost()
static gatherTemplate(int $role_ref_id, int $role_id)
static http()
Fetches the global http state from ILIAS.
static _lookupTitle(int $obj_id)
buildEditPage(?StandardForm $form=null)
confirmDeleteRoleObject()
Show delete confirmation screen.
isChangeExistingObjectsConfirmationRequired()
Check if a confirmation about further settings is required or not.
getParentObjId()
Get obj_id of current object.
performDeleteRoleObject()
Delete role.
static _getTranslation(string $a_role_title)
Class ilObjectGUI Basic methods of all Output classes.
setValue(string $a_value)
getParentType()
get type of current object (not role folder)
const FORM_KEY_ON_REGISTRATION_FORM
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
Class ilObjForumAdministration.
showDefaultPermissionSettings()
check if default permissions are shown or not
static _getIdsForTitle(string $title, string $type='', bool $partial_match=false)
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 redirect(string $a_script)
static add(int $action, int $ref_id, array $diff, bool $source_ref_id=false)
getParentRefId()
Get ref id of current object (not role folder id)
changeExistingObjectsObject()
const FORM_KEY_ALLOW_LOCAL_USER_ASSIGNMENT
userassignmentObject()
display user assignment panel
const MODE_UNPROTECTED_DELETE_LOCAL_POLICIES
addAdminLocatorItems(bool $do_not_add_object=false)
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...
__construct(Container $dic, ilPlugin $plugin)
const MODE_UNPROTECTED_KEEP_LOCAL_POLICIES
static diffTemplate(array $old, array $new)
TableGUI class for role administration.
getAdminTabs()
admin and normal tabs are equal for roles
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupType(int $id, bool $reference=false)
static allocateExportId()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addMultiCommand(string $a_cmd, string $a_text)
updateObject()
Save role settings.
static _getInstance()
Get instance of ilSecuritySettings.
static set(string $a_var, $a_val)
Set a value.
getContainerType()
Get type of role container.
static getInstance(int $a_usr_id)