ILIAS  trunk Revision v11.0_alpha-1749-g1a06bdef097
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilObjRoleGUI Class Reference

Class ilObjRoleGUI. More...

+ Inheritance diagram for ilObjRoleGUI:
+ Collaboration diagram for ilObjRoleGUI:

Public Member Functions

 executeCommand ()
 
 getParentRefId ()
 Get ref id of current object (not role folder id) More...
 
 getParentObjId ()
 Get obj_id of current object. More...
 
 getParentType ()
 get type of current object (not role folder) More...
 
 getAdminTabs ()
 admin and normal tabs are equal for roles More...
 
 createObject ()
 
 editObject ()
 
 saveObject ()
 Save new role. More...
 
 updateObject ()
 Save role settings. More...
 
 permSaveObject (bool $a_show_admin_permissions=false)
 save permissions public More...
 
 adoptPermSaveObject ()
 
 addUserObject (array $a_user_ids)
 
 deassignUserObject ()
 
 userassignmentObject ()
 display user assignment panel More...
 
 mailToRoleObject ()
 
 checkAccess (string $a_perm_global, string $a_perm_obj='')
 
- Public Member Functions inherited from ilObjectGUI
 getRefId ()
 
 setAdminMode (string $mode)
 
 getAdminMode ()
 
 getObject ()
 
 executeCommand ()
 
 withReferences ()
 determines whether objects are referenced or not (got ref ids or not) More...
 
 setCreationMode (bool $mode=true)
 If true, a creation screen is displayed the current [ref_id] does belong to the parent class The mode is determined in ilRepositoryGUI. More...
 
 getCreationMode ()
 
 prepareOutput (bool $show_sub_objects=true)
 
 getAdminTabs ()
 administration tabs show only permissions and trash folder More...
 
 getHTML ()
 
 confirmedDeleteObject ()
 confirmed deletion of object -> objects are moved to trash or deleted immediately, if trash is disabled More...
 
 cancelObject ()
 cancel action and go back to previous page More...
 
 createObject ()
 create new object form More...
 
 editAvailabilityPeriodObject ()
 
 saveAvailabilityPeriodObject ()
 
 cancelCreation ()
 cancel create action and go back to repository parent More...
 
 saveObject ()
 
 getDidacticTemplateVar (string $type)
 Get didactic template setting from creation screen. More...
 
 putObjectInTree (ilObject $obj, ?int $parent_node_id=null)
 Add object to tree at given position. More...
 
 editObject ()
 
 addExternalEditFormCustom (ilPropertyFormGUI $form)
 
 updateObject ()
 updates object entry in object_data More...
 
 getFormAction (string $cmd, string $default_form_action="")
 Get form action for command (command is method name without "Object", e.g. More...
 
 isVisible (int $ref_id, string $type)
 
 viewObject ()
 viewObject container presentation for "administration -> repository, trash, permissions" More...
 
 deleteObject (bool $error=false)
 Display deletion confirmation screen. More...
 
 setColumnSettings (ilColumnGUI $column_gui)
 
 addToDeskObject ()
 
 removeFromDeskObject ()
 
- Public Member Functions inherited from ILIAS\Object\ImplementsCreationCallback
 callCreationCallback (\ilObject $object, \ilObjectDefinition $obj_definition, int $requested_crtcb)
 

Protected Member Functions

 getRoleId ()
 
 initParentRefId ()
 
 retrieveTemplatePermissionsFromPost ()
 
 getContainerType ()
 Get type of role container. More...
 
 showDefaultPermissionSettings ()
 check if default permissions are shown or not More...
 
 getRoleForm (bool $is_role_creation_form=false)
 
 permObject (bool $a_show_admin_permissions=false)
 
 adminPermObject ()
 
 adminPermSaveObject ()
 
 adoptPermObject ()
 
 confirmDeleteRoleObject ()
 Show delete confirmation screen. More...
 
 performDeleteRoleObject ()
 Delete role. More...
 
 addAdminLocatorItems (bool $do_not_add_object=false)
 
 getTabs ()
 
 isChangeExistingObjectsConfirmationRequired ()
 Check if a confirmation about further settings is required or not. More...
 
 showChangeExistingObjectsConfirmation (bool $recursive, array $recursive_list)
 Show confirmation screen. More...
 
 changeExistingObjectsObject ()
 
 setSubTabs ($a_tab)
 
 addToClipboardObject ()
 Add selected users to user clipboard. More...
 
 addLocatorItems ()
 
 ensureRoleAccessForContext ()
 Ensure access to role for ref_id. More...
 
- Protected Member Functions inherited from ilObjectGUI
 getObjectService ()
 
 assignObject ()
 
 setTitleAndDescription ()
 
 createActionDispatcherGUI ()
 
 initHeaderAction (?string $sub_type=null, ?int $sub_id=null)
 Add header action menu. More...
 
 insertHeaderAction (?ilObjectListGUI $list_gui=null)
 Insert header action into main template. More...
 
 addHeaderAction ()
 Add header action menu. More...
 
 redrawHeaderActionObject ()
 Ajax call: redraw action header only. More...
 
 setTabs ()
 set admin tabs More...
 
 setAdminTabs ()
 set admin tabs More...
 
 setLocator ()
 
 addLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 omitLocator (bool $omit=true)
 
 addAdminLocatorItems (bool $do_not_add_object=false)
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 getCreationFormsHTML (StandardForm|ilPropertyFormGUI|array $form)
 
 getTitleForCreationFormPage ()
 
 getCreationFormTitle ()
 
 initCreateForm (string $new_type)
 
 didacticTemplatesToForm ()
 
 initDidacticTemplate (ilPropertyFormGUI $form)
 
 retrieveAdditionalDidacticTemplateOptions ()
 
 addAdoptContentLinkToToolbar ()
 
 addImportButtonToToolbar ()
 
 addAvailabilityPeriodButtonToToolbar (ilToolbarGUI $toolbar)
 
 parseDidacticTemplateVar (string $var, string $type)
 
 afterSave (ilObject $new_object)
 Post (successful) object creation hook. More...
 
 initEditForm ()
 
 initEditCustomForm (ilPropertyFormGUI $a_form)
 Add custom fields to update form. More...
 
 getEditFormValues ()
 
 getEditFormCustomValues (array &$a_values)
 Add values to custom edit fields. More...
 
 validateCustom (ilPropertyFormGUI $form)
 Validate custom values (if not possible with checkInput()) More...
 
 updateCustom (ilPropertyFormGUI $form)
 Insert custom update form values into object. More...
 
 afterUpdate ()
 Post (successful) object update hook. More...
 
 routeImportCmdObject ()
 
 importFile (string $file_to_import, string $path_to_uploaded_file_in_temp_dir)
 
 deleteUploadedImportFile (string $path_to_uploaded_file_in_temp_dir)
 
 afterImport (ilObject $new_object)
 Post (successful) object import hook. More...
 
 setFormAction (string $cmd, string $form_action)
 
 getReturnLocation (string $cmd, string $default_location="")
 Get return location for command (command is method name without "Object", e.g. More...
 
 setReturnLocation (string $cmd, string $location)
 set specific return location for command More...
 
 getTargetFrame (string $cmd, string $default_target_frame="")
 get target frame for command (command is method name without "Object", e.g. More...
 
 setTargetFrame (string $cmd, string $target_frame)
 Set specific target frame for command. More...
 
 showPossibleSubObjects ()
 show possible sub objects (pull down menu) More...
 
 getTabs ()
 overwrite in derived GUI class of your object type More...
 
 redirectToRefId (int $ref_id, string $cmd="")
 redirects to (repository) view per ref id usually to a container and usually used at the end of a save/import method where the object gui type (of the new object) doesn't match with the type of the current ["ref_id"] value of the request More...
 
 getCenterColumnHTML ()
 Get center column. More...
 
 getRightColumnHTML ()
 Display right column. More...
 
 checkPermission (string $perm, string $cmd="", string $type="", ?int $ref_id=null)
 
 checkPermissionBool (string $perm, string $cmd="", string $type="", ?int $ref_id=null)
 
 enableDragDropFileUpload ()
 Enables the file upload into this object by dropping files. More...
 
 getCreatableObjectTypes ()
 
 buildAddNewItemElements (array $subtypes, string $create_target_class=ilRepositoryGUI::class, ?int $redirect_target_ref_id=null,)
 
 buildGroup (string $create_target_class, array $obj_types_in_group, string $title, array $subtypes)
 

Protected Attributes

int $obj_ref_id = 0
 
int $obj_obj_id = 0
 
string $obj_obj_type = ''
 
string $container_type = ''
 
int $role_id = 0
 
ilHelpGUI $help
 
Factory $refinery
 
UIFactory $ui_factory
 
Renderer $ui_renderer
 
- Protected Attributes inherited from ilObjectGUI
ILIAS Notes Service $notes_service
 
ServerRequestInterface $request
 
ilLocatorGUI $locator
 
ilObjUser $user
 
ilAccessHandler $access
 
ilSetting $settings
 
ilToolbarGUI $toolbar
 
ilRbacAdmin $rbac_admin
 
ilRbacSystem $rbac_system
 
ilRbacReview $rbac_review
 
ilObjectService $object_service
 
ilObjectDefinition $obj_definition
 
ilGlobalTemplateInterface $tpl
 
ilTree $tree
 
ilCtrl $ctrl
 
ilErrorHandling $error
 
ilLanguage $lng
 
ilTabsGUI $tabs_gui
 
ILIAS $ilias
 
ArrayBasedRequestWrapper $post_wrapper
 
RequestWrapper $request_wrapper
 
Refinery $refinery
 
ilFavouritesManager $favourites
 
ilObjectCustomIconFactory $custom_icon_factory
 
UIFactory $ui_factory
 
UIRenderer $ui_renderer
 
Filesystem $temp_file_system
 
ilObject $object = null
 
bool $creation_mode = false
 
 $data
 
int $id
 
bool $call_by_reference = false
 
bool $prepare_output
 
int $ref_id
 
int $obj_id
 
int $maxcount
 
array $form_action = []
 
array $return_location = []
 
array $target_frame = []
 
string $tmp_import_dir
 
string $sub_objects = ""
 
bool $omit_locator = false
 
string $type = ""
 
string $admin_mode = self::ADMIN_MODE_NONE
 
int $requested_ref_id = 0
 
int $requested_crtptrefid = 0
 
int $requested_crtcb = 0
 
string $requested_new_type = ""
 
string $link_params
 
string $html = ""
 

Private Member Functions

 buildEditPage (?StandardForm $form=null)
 
 buildConfirmationModal ()
 

Private Attributes

const FORM_KEY_TITLE = 'title'
 
const FORM_KEY_DESCRIPTION = 'description'
 
const FORM_KEY_ILIAS_ID = 'ilias_id'
 
const FORM_KEY_ON_REGISTRATION_FORM = 'on_registration_form'
 
const FORM_KEY_ALLOW_LOCAL_USER_ASSIGNMENT = 'allow_local_user_assignment'
 
const FORM_KEY_PROTECT = 'protect'
 
ilLogger $logger
 
GlobalHttpState $http
 

Additional Inherited Members

- Static Public Member Functions inherited from ilObjectGUI
static _gotoRepositoryRoot (bool $raise_error=false)
 Goto repository root. More...
 
static _gotoRepositoryNode (int $ref_id, string $cmd="")
 
static _gotoSharedWorkspaceNode (int $wsp_id)
 
- Data Fields inherited from ilObjectGUI
const ADMIN_MODE_NONE = ""
 
const ADMIN_MODE_SETTINGS = "settings"
 
const ADMIN_MODE_REPOSITORY = "repository"
 
const UPLOAD_TYPE_LOCAL = 1
 
const UPLOAD_TYPE_UPLOAD_DIRECTORY = 2
 
const CFORM_NEW = 1
 
const CFORM_IMPORT = 2
 
const CFORM_CLONE = 3
 
const SUPPORTED_IMPORT_MIME_TYPES = [MimeType::APPLICATION__ZIP, MimeType::APPLICATION__X_ZIP_COMPRESSED]
 

Detailed Description

Member Function Documentation

◆ addAdminLocatorItems()

ilObjRoleGUI::addAdminLocatorItems ( bool  $do_not_add_object = false)
protected

Definition at line 995 of file class.ilObjRoleGUI.php.

References ilObjRole\_getTranslation(), ILIAS\Repository\ctrl(), ilObjectGUI\getAdminMode(), ILIAS\Repository\lng(), ILIAS\Repository\locator(), and ILIAS\Repository\object().

995  : void
996  {
997  if ($this->getAdminMode() === self::ADMIN_MODE_SETTINGS) {
998  parent::addAdminLocatorItems(true);
999 
1000  $this->locator->addItem(
1001  $this->lng->txt('obj_' . $this->getParentType()),
1002  $this->ctrl->getLinkTargetByClass("ilobjrolefoldergui", 'view')
1003  );
1004 
1005  if ($this->object instanceof ilObjRole) {
1006  $this->locator->addItem(
1007  ilObjRole::_getTranslation($this->object->getTitle()),
1008  $this->ctrl->getLinkTarget($this, 'perm')
1009  );
1010  }
1011  } else {
1012  parent::addAdminLocatorItems($do_not_add_object);
1013  }
1014  }
Class ilObjRole.
static _getTranslation(string $a_role_title)
+ Here is the call graph for this function:

◆ addLocatorItems()

ilObjRoleGUI::addLocatorItems ( )
protected

Definition at line 1267 of file class.ilObjRoleGUI.php.

References ilObjRole\_getTranslation(), ILIAS\Repository\ctrl(), ilObjectGUI\getAdminMode(), getRoleId(), ILIAS\Repository\locator(), and ILIAS\Repository\object().

1267  : void
1268  {
1269  if ($this->getAdminMode() === self::ADMIN_MODE_NONE || $this->getAdminMode() === self::ADMIN_MODE_REPOSITORY) {
1270  $this->ctrl->setParameterByClass(
1271  "ilobjrolegui",
1272  "obj_id",
1273  $this->getRoleId()
1274  );
1275  $this->locator->addItem(
1276  ilObjRole::_getTranslation($this->object->getTitle()),
1277  $this->ctrl->getLinkTargetByClass(
1278  [
1279  "ilpermissiongui",
1280  "ilobjrolegui"
1281  ],
1282  "perm"
1283  )
1284  );
1285  }
1286  }
static _getTranslation(string $a_role_title)
+ Here is the call graph for this function:

◆ addToClipboardObject()

ilObjRoleGUI::addToClipboardObject ( )
protected

Add selected users to user clipboard.

Definition at line 1240 of file class.ilObjRoleGUI.php.

References ILIAS\Repository\ctrl(), ilUserClipboard\getInstance(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), and ILIAS\Repository\user().

1240  : void
1241  {
1242  $users = [];
1243  if ($this->http->wrapper()->post()->has('user_id')) {
1244  $users = $this->http->wrapper()->post()->retrieve(
1245  'user_id',
1246  $this->refinery->kindlyTo()->listOf(
1247  $this->refinery->kindlyTo()->int()
1248  )
1249  );
1250  }
1251  if (count($users) === 0) {
1252  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'), true);
1253  $this->ctrl->redirect($this, 'userassignment');
1254  }
1255  $clip = ilUserClipboard::getInstance($this->user->getId());
1256  $clip->add($users);
1257  $clip->save();
1258 
1259  $this->lng->loadLanguageModule('user');
1260  $this->tpl->setOnScreenMessage('success', $this->lng->txt('clipboard_user_added'), true);
1261  $this->ctrl->redirect($this, 'userassignment');
1262  }
static http()
Fetches the global http state from ILIAS.
static getInstance(int $a_usr_id)
+ Here is the call graph for this function:

◆ addUserObject()

ilObjRoleGUI::addUserObject ( array  $a_user_ids)
Parameters
int[]

Definition at line 805 of file class.ilObjRoleGUI.php.

References $obj_ref_id, $user_id, ANONYMOUS_USER_ID, checkAccess(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ILIAS\Repository\object(), and ROLE_FOLDER_ID.

805  : void
806  {
807  if (!$this->checkAccess('edit_userassignment', 'edit_permission')) {
808  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('msg_no_perm_assign_user_to_role'), true);
809  return;
810  }
811  if (!$this->rbac_review->isAssignable($this->object->getId(), $this->obj_ref_id) &&
812  $this->obj_ref_id != ROLE_FOLDER_ID) {
813  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('err_role_not_assignable'), true);
814  return;
815  }
816  if ($a_user_ids === []) {
817  $this->lng->loadLanguageModule('search');
818  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('search_err_user_not_exist'), true);
819  return;
820  }
821 
822  $assigned_users_all = $this->rbac_review->assignedUsers($this->object->getId());
823 
824  // users to assign
825  $assigned_users_new = array_diff($a_user_ids, array_intersect($a_user_ids, $assigned_users_all));
826 
827  // selected users all already assigned. stop
828  if (count($assigned_users_new) == 0) {
829  $this->tpl->setOnScreenMessage('info', $this->lng->txt("rbac_msg_user_already_assigned"), true);
830  $this->ctrl->redirect($this, 'userassignment');
831  }
832 
833  // assign new users
834  foreach ($assigned_users_new as $user_id) {
835  if ($user_id === ANONYMOUS_USER_ID) {
836  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('msg_anonymous_cannot_be_assigned'), true);
837  return;
838  }
839  $this->rbac_admin->assignUser($this->object->getId(), $user_id, false);
840  }
841 
842  // update object data entry (to update last modification date)
843  $this->object->update();
844 
845  $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_userassignment_changed"), true);
846  $this->ctrl->redirect($this, 'userassignment');
847  }
const ANONYMOUS_USER_ID
Definition: constants.php:27
checkAccess(string $a_perm_global, string $a_perm_obj='')
const ROLE_FOLDER_ID
Definition: constants.php:34
+ Here is the call graph for this function:

◆ adminPermObject()

ilObjRoleGUI::adminPermObject ( )
protected

Definition at line 533 of file class.ilObjRoleGUI.php.

References permObject().

533  : void
534  {
535  $this->permObject(true);
536  }
permObject(bool $a_show_admin_permissions=false)
+ Here is the call graph for this function:

◆ adminPermSaveObject()

ilObjRoleGUI::adminPermSaveObject ( )
protected

Definition at line 538 of file class.ilObjRoleGUI.php.

References permSaveObject().

538  : void
539  {
540  $this->permSaveObject(true);
541  }
permSaveObject(bool $a_show_admin_permissions=false)
save permissions public
+ Here is the call graph for this function:

◆ adoptPermObject()

ilObjRoleGUI::adoptPermObject ( )
protected

Definition at line 543 of file class.ilObjRoleGUI.php.

References ilObjectGUI\$id, ilObjRole\_getTranslation(), ilUtil\_sortIds(), ILIAS\Repository\lng(), ILIAS\Repository\object(), and SYSTEM_ROLE_ID.

Referenced by adoptPermSaveObject().

543  : void
544  {
545  $output = [];
546  $parent_role_ids = $this->rbac_review->getParentRoleIds($this->obj_ref_id, true);
547 
548  $this->tabs_gui->clearTargets();
549 
550  $ids = [];
551  foreach (array_keys($parent_role_ids) as $id) {
552  $ids[] = $id;
553  }
554  // Sort ids
555  $sorted_ids = ilUtil::_sortIds($ids, 'object_data', 'type,title', 'obj_id');
556  $key = 0;
557  foreach ($sorted_ids as $id) {
558  $par = $parent_role_ids[$id];
559  if ($par["obj_id"] != SYSTEM_ROLE_ID && $this->object->getId() != $par["obj_id"]) {
560  $output[$key]["role_id"] = $par["obj_id"];
561  $output[$key]["type"] = ($par["type"] == 'role' ? $this->lng->txt('obj_role') : $this->lng->txt('obj_rolt'));
562  $output[$key]["role_name"] = ilObjRole::_getTranslation($par["title"]);
563  $output[$key]["role_desc"] = $par["desc"];
564  $key++;
565  }
566  }
567 
568  $tbl = new ilRoleAdoptPermissionTableGUI($this, "adoptPerm");
569  $tbl->setTitle($this->lng->txt("adopt_perm_from_template"));
570  $tbl->setData($output);
571 
572  $this->tpl->setContent($tbl->getHTML());
573  }
const SYSTEM_ROLE_ID
Definition: constants.php:29
static _getTranslation(string $a_role_title)
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.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ adoptPermSaveObject()

ilObjRoleGUI::adoptPermSaveObject ( )

Definition at line 756 of file class.ilObjRoleGUI.php.

References ilObjectGUI\$access, $obj_ref_id, ilObjRole\_getTranslation(), ilObject\_lookupTitle(), adoptPermObject(), checkAccess(), ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\object(), and ILIAS\Repository\refinery().

756  : void
757  {
758  $source = 0;
759  if ($this->http->wrapper()->post()->has('adopt')) {
760  $source = $this->http->wrapper()->post()->retrieve(
761  'adopt',
762  $this->refinery->kindlyTo()->int()
763  );
764  }
765 
766  if (!$source) {
767  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'));
768  $this->adoptPermObject();
769  return;
770  }
771 
772  $access = $this->checkAccess('visible,write', 'edit_permission');
773  if (!$access) {
774  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('msg_no_perm_perm'), true);
775  }
776  if ($this->object->getId() == $source) {
777  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("msg_perm_adopted_from_itself"), true);
778  } else {
779  $this->rbac_admin->deleteRolePermission($this->object->getId(), $this->obj_ref_id);
780  $parentRoles = $this->rbac_review->getParentRoleIds($this->obj_ref_id, true);
781  $this->rbac_admin->copyRoleTemplatePermissions(
782  $source,
783  $parentRoles[$source]["parent"],
784  $this->obj_ref_id,
785  $this->object->getId(),
786  false
787  );
788 
789  // update object data entry (to update last modification date)
790  $this->object->update();
791 
792  // send info
793  $title = ilObject::_lookupTitle($source);
794  $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_perm_adopted_from1") . " '" .
795  ilObjRole::_getTranslation($title) . "'.<br/>" .
796  $this->lng->txt("msg_perm_adopted_from2"), true);
797  }
798 
799  $this->ctrl->redirect($this, "perm");
800  }
checkAccess(string $a_perm_global, string $a_perm_obj='')
static http()
Fetches the global http state from ILIAS.
static _lookupTitle(int $obj_id)
static _getTranslation(string $a_role_title)
ilAccessHandler $access
+ Here is the call graph for this function:

◆ buildConfirmationModal()

ilObjRoleGUI::buildConfirmationModal ( )
private

Definition at line 1320 of file class.ilObjRoleGUI.php.

References $message, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\object().

Referenced by buildEditPage(), and permObject().

1321  {
1322  $message = $this->lng->txt('rbac_role_delete_qst');
1323  if ($this->rbac_review->isAssigned($this->user->getId(), $this->object->getId())) {
1324  $message .= ('<br />' . $this->lng->txt('rbac_role_delete_self'));
1325  }
1326  return $this->ui_factory->modal()->interruptive(
1327  $this->lng->txt('confirm'),
1328  $message,
1329  $this->ctrl->getFormActionByClass(self::class, 'performDeleteRole')
1330  )->withAffectedItems([
1331  $this->ui_factory->modal()->interruptiveItem()->standard(
1332  (string) $this->object->getId(),
1333  $this->object->getTitle()
1334  )
1335  ]);
1336  }
$message
Definition: xapiexit.php:31
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildEditPage()

ilObjRoleGUI::buildEditPage ( ?StandardForm  $form = null)
private

Definition at line 411 of file class.ilObjRoleGUI.php.

References $obj_ref_id, buildConfirmationModal(), ILIAS\Repository\ctrl(), getRoleForm(), ILIAS\Repository\lng(), ILIAS\Repository\object(), SYSTEM_ROLE_ID, and ILIAS\Repository\toolbar().

Referenced by editObject(), and updateObject().

411  : void
412  {
413  $page_content = [];
414  if ($this->object->getId() != SYSTEM_ROLE_ID) {
415  $this->toolbar->setFormAction($this->ctrl->getFormAction($this));
416  if ($this->rbac_review->isDeleteable($this->object->getId(), $this->obj_ref_id)) {
417  $modal = $this->buildConfirmationModal();
418  $this->toolbar->addComponent(
419  $this->ui_factory->button()->standard(
420  $this->lng->txt('rbac_delete_role'),
421  $modal->getShowSignal()
422  )
423  );
424  $page_content[] = $modal;
425  }
426  }
427 
428  $page_content[] = $this->ui_factory->panel()->standard(
429  $this->lng->txt('role_edit'),
430  $form ?? $this->getRoleForm()
431  );
432 
433  $this->tpl->setContent(
434  $this->ui_renderer->render($page_content)
435  );
436  }
getRoleForm(bool $is_role_creation_form=false)
const SYSTEM_ROLE_ID
Definition: constants.php:29
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ changeExistingObjectsObject()

ilObjRoleGUI::changeExistingObjectsObject ( )
protected

Definition at line 1191 of file class.ilObjRoleGUI.php.

References $obj_ref_id, ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), ROLE_FOLDER_ID, and ROOT_FOLDER_ID.

1191  : void
1192  {
1193  $mode = 0;
1194  if ($this->http->wrapper()->post()->has('mode')) {
1195  $mode = $this->http->wrapper()->post()->retrieve(
1196  'mode',
1197  $this->refinery->kindlyTo()->int()
1198  );
1199  }
1200  $start = ($this->obj_ref_id == ROLE_FOLDER_ID ? ROOT_FOLDER_ID : $this->obj_ref_id);
1201 
1202  $type_filter = [];
1203  if ($this->http->wrapper()->post()->has('type_filter')) {
1204  $serialized_type_filter = $this->http->wrapper()->post()->retrieve(
1205  'type_filter',
1206  $this->refinery->kindlyTo()->string()
1207  );
1208  $type_filter = json_decode(
1209  $serialized_type_filter,
1210  true
1211  );
1212  }
1213 
1214  $this->object->changeExistingObjects($start, $mode, $type_filter);
1215  $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
1216  $this->ctrl->redirect($this, 'perm');
1217  }
const ROOT_FOLDER_ID
Definition: constants.php:32
static http()
Fetches the global http state from ILIAS.
const ROLE_FOLDER_ID
Definition: constants.php:34
+ Here is the call graph for this function:

◆ checkAccess()

ilObjRoleGUI::checkAccess ( string  $a_perm_global,
string  $a_perm_obj = '' 
)

Definition at line 1101 of file class.ilObjRoleGUI.php.

References ILIAS\Repository\access(), and ROLE_FOLDER_ID.

Referenced by addUserObject(), adoptPermSaveObject(), confirmDeleteRoleObject(), deassignUserObject(), editObject(), getTabs(), performDeleteRoleObject(), permObject(), permSaveObject(), and userassignmentObject().

1101  : bool
1102  {
1103  $a_perm_obj = $a_perm_obj ?: $a_perm_global;
1104 
1105  if ($this->obj_ref_id == ROLE_FOLDER_ID) {
1106  return $this->rbac_system->checkAccess($a_perm_global, $this->obj_ref_id);
1107  } else {
1108  return $this->access->checkAccess($a_perm_obj, '', $this->obj_ref_id);
1109  }
1110  }
const ROLE_FOLDER_ID
Definition: constants.php:34
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ confirmDeleteRoleObject()

ilObjRoleGUI::confirmDeleteRoleObject ( )
protected

Show delete confirmation screen.

Definition at line 578 of file class.ilObjRoleGUI.php.

References ilObjRole\_getTranslation(), checkAccess(), ILIAS\Repository\ctrl(), ilUtil\getImagePath(), ILIAS\Repository\lng(), and ILIAS\Repository\object().

578  : void
579  {
580  $this->tabs_gui->clearTargets();
581 
582  if (!$this->checkAccess('visible,write', 'edit_permission')) {
583  $this->tpl->setOnScreenMessage('msg_no_perm_perm', $this->lng->txt('permission_denied'), true);
584  $this->ctrl->redirectByClass(ilRepositoryGUI::class);
585  }
586 
587  $question = $this->lng->txt('rbac_role_delete_qst');
588  if ($this->rbac_review->isAssigned($this->user->getId(), $this->object->getId())) {
589  $question .= ('<br />' . $this->lng->txt('rbac_role_delete_self'));
590  }
591  $this->tpl->setOnScreenMessage('question', $question);
592 
593  $confirm = new ilConfirmationGUI();
594  $confirm->setFormAction($this->ctrl->getFormAction($this));
595  $confirm->setHeaderText($question);
596  $confirm->setCancel($this->lng->txt('cancel'), 'perm');
597  $confirm->setConfirm($this->lng->txt('rbac_delete_role'), 'performDeleteRole');
598 
599  $confirm->addItem(
600  'role',
601  (string) $this->object->getId(),
602  ilObjRole::_getTranslation($this->object->getTitle()),
603  ilUtil::getImagePath('standard/icon_role.svg')
604  );
605 
606  $this->tpl->setContent($confirm->getHTML());
607  }
checkAccess(string $a_perm_global, string $a_perm_obj='')
static _getTranslation(string $a_role_title)
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
+ Here is the call graph for this function:

◆ createObject()

ilObjRoleGUI::createObject ( )

Definition at line 301 of file class.ilObjRoleGUI.php.

References ILIAS\Repository\ctrl(), getRoleForm(), and ILIAS\Repository\lng().

301  : void
302  {
303  if (!$this->rbac_system->checkAccess('create_role', $this->obj_ref_id)) {
304  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('permission_denied'), true);
305  $this->ctrl->returnToParent(ilRepositoryGUI::class);
306  }
307 
308  $this->tabs_gui->setBackTarget(
309  $this->lng->txt('cancel'),
310  $this->ctrl->getParentReturnByClass(self::class)
311  );
312 
313  $this->tpl->setContent(
314  $this->ui_renderer->render(
315  $this->ui_factory->panel()->standard(
316  $this->lng->txt('role_new'),
317  $this->getRoleForm(true)
318  )
319  )
320  );
321  }
getRoleForm(bool $is_role_creation_form=false)
+ Here is the call graph for this function:

◆ deassignUserObject()

ilObjRoleGUI::deassignUserObject ( )

Definition at line 849 of file class.ilObjRoleGUI.php.

References ilObjectGUI\$user, checkAccess(), ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\object(), ILIAS\Repository\refinery(), SYSTEM_ROLE_ID, and SYSTEM_USER_ID.

849  : void
850  {
851  if (!$this->checkAccess('edit_userassignment', 'edit_permission')) {
852  $this->ilias->raiseError(
853  $this->lng->txt("msg_no_perm_assign_user_to_role"),
854  $this->ilias->error_obj->MESSAGE
855  );
856  }
857 
858  $selected_users = [];
859  if ($this->http->wrapper()->query()->has('user_id')) {
860  $selected_users = [
861  $this->http->wrapper()->query()->retrieve(
862  'user_id',
863  $this->refinery->kindlyTo()->int()
864  )
865  ];
866  }
867  if ($this->http->wrapper()->post()->has('user_id')) {
868  $selected_users = $this->http->wrapper()->post()->retrieve(
869  'user_id',
870  $this->refinery->kindlyTo()->listOf(
871  $this->refinery->kindlyTo()->int()
872  )
873  );
874  }
875  if (count($selected_users) === 0) {
876  $this->ilias->raiseError($this->lng->txt("no_checkbox"), $this->ilias->error_obj->MESSAGE);
877  }
878 
879  // prevent unassignment of system user from system role
880  if ($this->object->getId() == SYSTEM_ROLE_ID) {
881  if ($admin = array_search(SYSTEM_USER_ID, $selected_users) !== false) {
882  unset($selected_users[$admin]);
883  }
884  }
885 
886  // check for each user if the current role is his last global role before deassigning him
887  $last_role = [];
888  $global_roles = $this->rbac_review->getGlobalRoles();
889  foreach ($selected_users as $user) {
890  $assigned_roles = $this->rbac_review->assignedRoles($user);
891  $assigned_global_roles = array_intersect($assigned_roles, $global_roles);
892 
893  if (count($assigned_roles) == 1 || count($assigned_global_roles) == 1 && in_array(
894  $this->object->getId(),
895  $assigned_global_roles
896  )) {
897  $userObj = new ilObjUser($user);
898  $last_role[$user] = $userObj->getFullName();
899  unset($userObj);
900  }
901  }
902 
903  // ... else perform deassignment
904  foreach ($selected_users as $user) {
905  if (!isset($last_role[$user])) {
906  $this->rbac_admin->deassignUser($this->object->getId(), $user);
907  }
908  }
909 
910  // update object data entry (to update last modification date)
911  $this->object->update();
912 
913  // raise error if last role was taken from a user...
914  if ($last_role !== []) {
915  $user_list = implode(", ", $last_role);
916  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('msg_is_last_role') . ': ' . $user_list . '<br />' . $this->lng->txt('msg_min_one_role'), true);
917  } else {
918  $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_userassignment_changed"), true);
919  }
920  $this->ctrl->redirect($this, 'userassignment');
921  }
const SYSTEM_ROLE_ID
Definition: constants.php:29
const SYSTEM_USER_ID
This file contains constants for PHPStan analyis, see: https://phpstan.org/config-reference#constants...
Definition: constants.php:26
checkAccess(string $a_perm_global, string $a_perm_obj='')
static http()
Fetches the global http state from ILIAS.
Class ilObjForumAdministration.
+ Here is the call graph for this function:

◆ editObject()

ilObjRoleGUI::editObject ( )

Definition at line 323 of file class.ilObjRoleGUI.php.

References buildEditPage(), checkAccess(), ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

323  : void
324  {
325  if (!$this->checkAccess('write', 'edit_permission')) {
326  $this->tpl->setOnScreenMessage('msg_no_perm_write', $this->lng->txt('permission_denied'), true);
327  $this->ctrl->returnToParent($this);
328  }
329  $this->tabs_gui->activateTab('edit_properties');
330 
331  $this->buildEditPage();
332  }
checkAccess(string $a_perm_global, string $a_perm_obj='')
buildEditPage(?StandardForm $form=null)
+ Here is the call graph for this function:

◆ ensureRoleAccessForContext()

ilObjRoleGUI::ensureRoleAccessForContext ( )
protected

Ensure access to role for ref_id.

Exceptions
ilObjectException

Definition at line 1292 of file class.ilObjRoleGUI.php.

References Vendor\Package\$e, $obj_ref_id, ILIAS\Repository\lng(), ILIAS\Repository\logger(), ILIAS\Repository\object(), and ROLE_FOLDER_ID.

Referenced by executeCommand().

1292  : bool
1293  {
1294  // creation of roles
1295  if (
1296  !$this->object->getId() ||
1297  $this->object->getId() == ROLE_FOLDER_ID
1298  ) {
1299  return true;
1300  }
1301 
1302  $possible_roles = [];
1303  try {
1304  $possible_roles = $this->rbac_review->getRolesOfObject(
1305  $this->obj_ref_id,
1306  false
1307  );
1308  } catch (\InvalidArgumentException $e) {
1309  $this->logger->warning('Role access check failed: ' . $e);
1310  throw new \ilObjectException($this->lng->txt('permission_denied'));
1311  }
1312 
1313  if (!in_array($this->object->getId(), $possible_roles)) {
1314  $this->logger->warning('Object id: ' . $this->object->getId() . ' is not accessible for ref_id: ' . $this->obj_ref_id);
1315  throw new \ilObjectException($this->lng->txt('permission_denied'));
1316  }
1317  return true;
1318  }
const ROLE_FOLDER_ID
Definition: constants.php:34
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilObjRoleGUI::executeCommand ( )

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

References $obj_ref_id, ILIAS\Repository\access(), ilExportOptions\allocateExportId(), ILIAS\Repository\ctrl(), ensureRoleAccessForContext(), ilExportOptions\KEY_ROOT, ILIAS\Repository\lng(), ilExportOptions\newInstance(), ILIAS\Repository\object(), ilObjectGUI\prepareOutput(), and showDefaultPermissionSettings().

87  : void
88  {
89  $this->prepareOutput();
90 
91  $next_class = $this->ctrl->getNextClass($this);
92  $cmd = $this->ctrl->getCmd();
93 
95 
96  switch ($next_class) {
97  case 'ilrepositorysearchgui':
98 
99  if (!$this->access->checkAccess('edit_permission', '', $this->obj_ref_id)) {
100  $this->error->raiseError(
101  $this->lng->txt('permission_denied'),
102  $this->error->WARNING
103  );
104  }
105  $rep_search = new ilRepositorySearchGUI();
106  $rep_search->setTitle($this->lng->txt('role_add_user'));
107  $rep_search->setCallback($this, 'addUserObject');
108 
109  // Set tabs
110  $this->tabs_gui->setTabActive('user_assignment');
111  $this->ctrl->setReturn($this, 'userassignment');
112  $ret = $this->ctrl->forwardCommand($rep_search);
113  break;
114 
115  case 'ilexportgui':
116 
117  $this->tabs_gui->setTabActive('export');
118 
120  $eo->addOption(ilExportOptions::KEY_ROOT, 0, $this->object->getId(), $this->obj_ref_id);
121 
122  $exp = new ilExportGUI($this, new ilObjRole($this->object->getId()));
123  $exp->addFormat('xml');
124  $this->ctrl->forwardCommand($exp);
125  break;
126 
127  case 'ilrecommendedcontentroleconfiggui':
128  $this->tabs_gui->setTabActive('rep_recommended_content');
129  $ui = new ilRecommendedContentRoleConfigGUI($this->object->getId(), $this->obj_ref_id);
130  $this->ctrl->forwardCommand($ui);
131  break;
132 
133  default:
134  if (!$cmd) {
135  if ($this->showDefaultPermissionSettings()) {
136  $cmd = "perm";
137  } else {
138  $cmd = 'userassignment';
139  }
140  }
141  $cmd .= "Object";
142  $this->$cmd();
143 
144  break;
145  }
146  }
Class ilObjRole.
prepareOutput(bool $show_sub_objects=true)
static newInstance(int $a_export_id)
ensureRoleAccessForContext()
Ensure access to role for ref_id.
showDefaultPermissionSettings()
check if default permissions are shown or not
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ getAdminTabs()

ilObjRoleGUI::getAdminTabs ( )

admin and normal tabs are equal for roles

Definition at line 214 of file class.ilObjRoleGUI.php.

References getTabs().

214  : void
215  {
216  $this->getTabs();
217  }
+ Here is the call graph for this function:

◆ getContainerType()

ilObjRoleGUI::getContainerType ( )
protected

Get type of role container.

Definition at line 222 of file class.ilObjRoleGUI.php.

References $container_type.

Referenced by showDefaultPermissionSettings().

222  : string
223  {
224  return $this->container_type;
225  }
+ Here is the caller graph for this function:

◆ getParentObjId()

ilObjRoleGUI::getParentObjId ( )

Get obj_id of current object.

Definition at line 198 of file class.ilObjRoleGUI.php.

References $obj_obj_id.

198  : int
199  {
200  return $this->obj_obj_id;
201  }

◆ getParentRefId()

ilObjRoleGUI::getParentRefId ( )

Get ref id of current object (not role folder id)

Definition at line 190 of file class.ilObjRoleGUI.php.

References $obj_ref_id.

Referenced by permObject().

190  : int
191  {
192  return $this->obj_ref_id;
193  }
+ Here is the caller graph for this function:

◆ getParentType()

ilObjRoleGUI::getParentType ( )

get type of current object (not role folder)

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

References $obj_obj_type.

Referenced by permObject(), and permSaveObject().

206  : string
207  {
208  return $this->obj_obj_type;
209  }
+ Here is the caller graph for this function:

◆ getRoleForm()

ilObjRoleGUI::getRoleForm ( bool  $is_role_creation_form = false)
protected

Definition at line 236 of file class.ilObjRoleGUI.php.

References ILIAS\UI\Implementation\Component\Input\$inputs, ILIAS\Repository\ctrl(), IL_INST_ID, ILIAS\Repository\lng(), ILIAS\Repository\object(), ILIAS\Repository\refinery(), ROLE_FOLDER_ID, and ILIAS\UI\Implementation\Component\Input\withValue().

Referenced by buildEditPage(), createObject(), saveObject(), and updateObject().

236  : StandardForm
237  {
238  if ($this->creation_mode) {
239  $this->ctrl->setParameter($this, 'new_type', 'role');
240  }
241 
242  $ff = $this->ui_factory->input()->field();
243 
244  $title_validation_constraint = $this->refinery->custom()->constraint(
245  fn(string $v): bool => preg_match('/^il_.*$/', $v) ? false : true,
246  $this->lng->txt('msg_role_reserved_prefix')
247  );
248 
249  $role_is_autogenerated = false;
250 
251  if (!$is_role_creation_form) {
252  $role_is_autogenerated = $this->object->isAutoGenerated();
253  }
254 
255  $inputs = [
256  self::FORM_KEY_TITLE => $ff->text($this->lng->txt('title'))
257  ->withMaxLength(70)
258  ->withRequired(true)
259  ->withAdditionalTransformation($title_validation_constraint)
260  ->withValue($is_role_creation_form ? '' : $this->object->getTitle())
261  ->withDisabled($role_is_autogenerated),
262  self::FORM_KEY_DESCRIPTION => $ff->textarea($this->lng->txt('description'))
263  ->withMaxLimit(4000)
264  ->withValue($is_role_creation_form ? '' : $this->object->getDescription())
265  ->withDisabled($role_is_autogenerated),
266 
267  ];
268 
269  if (!$is_role_creation_form) {
270  $inputs[self::FORM_KEY_ILIAS_ID] = $ff->text($this->lng->txt('ilias_id'))
271  ->withDisabled(true)
272  ->withValue('il_' . IL_INST_ID . '_'
273  . $this->object->getType() . '_' . $this->object->getId());
274  }
275 
276  if ($this->obj_ref_id === ROLE_FOLDER_ID) {
277  $inputs[self::FORM_KEY_ON_REGISTRATION_FORM] = $ff->checkbox($this->lng->txt('allow_register'))
278  ->withValue($is_role_creation_form ? false : $this->object->getAllowRegister());
279  $inputs[self::FORM_KEY_ALLOW_LOCAL_USER_ASSIGNMENT] = $ff->checkbox($this->lng->txt('allow_assign_users'))
280  ->withValue($is_role_creation_form ? false : $this->object->getAssignUsersStatus());
281  }
282 
283  $inputs[self::FORM_KEY_PROTECT] = $ff->checkbox($this->lng->txt('role_protect_permissions'))
284  ->withValue(
285  $is_role_creation_form
286  ? false
287  : $this->rbac_review->isProtected($this->obj_ref_id, $this->object->getId())
288  );
289 
290  return $this->ui_factory->input()->container()->form()->standard(
291  $this->ctrl->getFormActionByClass(
292  self::class,
293  $is_role_creation_form ? 'save' : 'update'
294  ),
295  $inputs
296  )->withSubmitLabel(
297  $is_role_creation_form ? $this->lng->txt('role_new') : $this->lng->txt('save')
298  );
299  }
const IL_INST_ID
Definition: constants.php:40
withValue($value)
Get an input like this with another value displayed on the client side.
Definition: Group.php:61
const ROLE_FOLDER_ID
Definition: constants.php:34
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRoleId()

ilObjRoleGUI::getRoleId ( )
protected

Definition at line 148 of file class.ilObjRoleGUI.php.

References $role_id.

Referenced by addLocatorItems().

148  : int
149  {
150  return $this->role_id;
151  }
+ Here is the caller graph for this function:

◆ getTabs()

ilObjRoleGUI::getTabs ( )
protected

Definition at line 1016 of file class.ilObjRoleGUI.php.

References ANONYMOUS_ROLE_ID, checkAccess(), ILIAS\Repository\ctrl(), ilObjectGUI\getAdminMode(), ILIAS\Repository\help(), ILIAS\Repository\lng(), ILIAS\Repository\object(), and showDefaultPermissionSettings().

Referenced by getAdminTabs().

1016  : void
1017  {
1018  $base_role_container = $this->rbac_review->getFoldersAssignedToRole($this->object->getId(), true);
1019  $activate_role_edit = false;
1020 
1021  // todo: activate the following (allow editing of local roles in
1022  // roles administration)
1023  if (
1024  in_array($this->obj_ref_id, $base_role_container) ||
1025  $this->getAdminMode() === self::ADMIN_MODE_SETTINGS
1026  ) {
1027  $activate_role_edit = true;
1028  }
1029 
1030  // not so nice (workaround for using tabs in repository)
1031  $this->tabs_gui->clearTargets();
1032 
1033  $this->help->setScreenIdComponent('role');
1034  $this->tabs_gui->setBackTarget(
1035  $this->lng->txt('btn_back'),
1036  (string) $this->ctrl->getParentReturn($this)
1037  );
1038  if ($this->checkAccess('write', 'edit_permission') && $activate_role_edit) {
1039  $this->tabs_gui->addTarget(
1040  "edit_properties",
1041  $this->ctrl->getLinkTarget($this, "edit"),
1042  ["edit", "update"],
1043  get_class($this)
1044  );
1045  }
1046  if ($this->checkAccess('write', 'edit_permission') && $this->showDefaultPermissionSettings()) {
1047  $this->tabs_gui->addTarget(
1048  'default_perm_settings',
1049  $this->ctrl->getLinkTarget($this, 'perm'),
1050  [],
1051  get_class($this)
1052  );
1053  }
1054 
1055  if ($this->checkAccess(
1056  'write',
1057  'edit_permission'
1058  ) && $activate_role_edit && $this->object->getId() != ANONYMOUS_ROLE_ID) {
1059  $this->tabs_gui->addTarget(
1060  'user_assignment',
1061  $this->ctrl->getLinkTarget($this, 'userassignment'),
1062  ['deassignUser', 'userassignment', 'assignUser', 'searchUserForm', 'search'],
1063  get_class($this)
1064  );
1065  }
1066 
1067  if ($this->checkAccess(
1068  'write',
1069  'edit_permission'
1070  ) && $activate_role_edit && $this->object->getId() != ANONYMOUS_ROLE_ID) {
1071  $this->lng->loadLanguageModule('rep');
1072  $this->tabs_gui->addTarget(
1073  'rep_recommended_content',
1074  $this->ctrl->getLinkTargetByClass('ilrecommendedcontentroleconfiggui', '')
1075  );
1076  }
1077  if ($this->checkAccess('write', 'edit_permission')) {
1078  $this->tabs_gui->addTarget(
1079  'export',
1080  $this->ctrl->getLinkTargetByClass('ilExportGUI'),
1081  []
1082  );
1083  }
1084  }
checkAccess(string $a_perm_global, string $a_perm_obj='')
showDefaultPermissionSettings()
check if default permissions are shown or not
const ANONYMOUS_ROLE_ID
Definition: constants.php:28
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initParentRefId()

ilObjRoleGUI::initParentRefId ( )
protected

Definition at line 153 of file class.ilObjRoleGUI.php.

References ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

153  : void
154  {
155  $this->obj_ref_id = 0;
156 
157  if ($this->http->wrapper()->query()->has('rolf_ref_id')) {
158  $this->obj_ref_id = $this->http->wrapper()->query()->retrieve(
159  'rolf_ref_id',
160  $this->refinery->kindlyTo()->int()
161  );
162  } elseif ($this->http->wrapper()->query()->has('ref_id')) {
163  $this->obj_ref_id = $this->http->wrapper()->query()->retrieve(
164  'ref_id',
165  $this->refinery->kindlyTo()->int()
166  );
167  }
168  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:

◆ isChangeExistingObjectsConfirmationRequired()

ilObjRoleGUI::isChangeExistingObjectsConfirmationRequired ( )
protected

Check if a confirmation about further settings is required or not.

Definition at line 1115 of file class.ilObjRoleGUI.php.

Referenced by permSaveObject().

1115  : bool
1116  {
1117  // Role is protected
1118  if ($this->rbac_review->isProtected($this->obj_ref_id, $this->object->getId())) {
1119  // TODO: check if recursive_list is enabled
1120  // and if yes: check if inheritance is broken for the relevant object types
1121  return count($this->rbac_review->getFoldersAssignedToRole($this->object->getId())) > 1;
1122  } else {
1123  // TODO: check if recursive_list is enabled
1124  // and if yes: check if inheritance is broken for the relevant object types
1125  return count($this->rbac_review->getFoldersAssignedToRole($this->object->getId())) > 1;
1126  }
1127  }
+ Here is the caller graph for this function:

◆ mailToRoleObject()

ilObjRoleGUI::mailToRoleObject ( )

Definition at line 1086 of file class.ilObjRoleGUI.php.

References ilObject\_getIdsForTitle(), ilSession\get(), ilMailFormCall\getRedirectTarget(), ILIAS\Repository\object(), ilUtil\redirect(), and ilSession\set().

1086  : void
1087  {
1088  $mail_roles = (array) (ilSession::get('mail_roles') ?? []);
1089 
1090  $obj_ids = ilObject::_getIdsForTitle($this->object->getTitle(), $this->object->getType());
1091  if (count($obj_ids) > 1) {
1092  $mail_roles[] = '#il_role_' . $this->object->getId();
1093  } else {
1094  $mail_roles[] = (new \ilRoleMailboxAddress($this->object->getId()))->value();
1095  }
1096  ilSession::set('mail_roles', $mail_roles);
1097  $script = ilMailFormCall::getRedirectTarget($this, 'userassignment', [], ['type' => 'role']);
1098  ilUtil::redirect($script);
1099  }
static get(string $a_var)
static _getIdsForTitle(string $title, string $type='', bool $partial_match=false)
static redirect(string $a_script)
static getRedirectTarget( $gui, string $cmd, array $gui_params=[], array $mail_params=[], array $context_params=[])
static set(string $a_var, $a_val)
Set a value.
+ Here is the call graph for this function:

◆ performDeleteRoleObject()

ilObjRoleGUI::performDeleteRoleObject ( )
protected

Delete role.

Definition at line 612 of file class.ilObjRoleGUI.php.

References checkAccess(), ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

612  : void
613  {
614  if (!$this->checkAccess('visible,write', 'edit_permission')) {
615  $this->tpl->setOnScreenMessage('msg_no_perm_perm', $this->lng->txt('permission_denied'), true);
616  $this->ctrl->redirectByClass(ilRepositoryGUI::class);
617  }
618 
619  $this->object->setParent($this->obj_ref_id);
620  $this->object->delete();
621  $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_deleted_role'), true);
622 
623  $this->ctrl->returnToParent($this);
624  }
checkAccess(string $a_perm_global, string $a_perm_obj='')
+ Here is the call graph for this function:

◆ permObject()

ilObjRoleGUI::permObject ( bool  $a_show_admin_permissions = false)
protected

Definition at line 438 of file class.ilObjRoleGUI.php.

References $obj_ref_id, ilTable2GUI\addMultiCommand(), buildConfirmationModal(), checkAccess(), ILIAS\Repository\ctrl(), ilAccordionGUI\FORCE_ALL_OPEN, getParentRefId(), getParentType(), ILIAS\Repository\lng(), ILIAS\Repository\object(), ilObjectRoleTemplatePermissionTableGUI\parse(), ROLE_FOLDER_ID, setSubTabs(), SYSTEM_ROLE_ID, and ILIAS\Repository\toolbar().

Referenced by adminPermObject().

438  : void
439  {
440  $this->tabs_gui->setTabActive('default_perm_settings');
441 
442  $this->setSubTabs('default_perm_settings');
443 
444  if (!$this->checkAccess('write', 'edit_permission')) {
445  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('msg_no_perm_write'), true);
446  $this->ctrl->returnToParent($this);
447  }
448 
449  if ($a_show_admin_permissions) {
450  $this->tabs_gui->setSubTabActive('rbac_admin_permissions');
451  } else {
452  $this->tabs_gui->setSubTabActive('rbac_repository_permissions');
453  }
454 
455  $this->tpl->addBlockFile(
456  'ADM_CONTENT',
457  'adm_content',
458  'tpl.rbac_template_permissions.html',
459  'components/ILIAS/AccessControl'
460  );
461 
462  if ($this->object->getId() !== SYSTEM_ROLE_ID) {
463  $this->toolbar->setFormAction($this->ctrl->getFormAction($this));
464  $this->toolbar->addComponent(
465  $this->ui_factory->link()->standard(
466  $this->lng->txt("adopt_perm_from_template"),
467  $this->ctrl->getLinkTarget($this, 'adoptPerm')
468  )
469  );
470  if ($this->rbac_review->isDeleteable($this->object->getId(), $this->obj_ref_id)) {
471  $modal = $this->buildConfirmationModal();
472  $this->toolbar->addComponent(
473  $this->ui_factory->button()->standard(
474  $this->lng->txt('rbac_delete_role'),
475  $modal->getShowSignal()
476  )
477  );
478  $this->tpl->setVariable('DELETION_MODAL', $this->ui_renderer->render($modal));
479  }
480  }
481 
482  $this->tpl->setVariable('PERM_ACTION', $this->ctrl->getFormAction($this));
483 
484  $acc = new ilAccordionGUI();
485  $acc->setBehaviour(ilAccordionGUI::FORCE_ALL_OPEN);
486  $acc->setId('template_perm_' . $this->getParentRefId());
487 
488  if ($this->obj_ref_id == ROLE_FOLDER_ID) {
489  if ($a_show_admin_permissions) {
490  $subs = ilObjRole::getSubObjects('adm', true);
491  } else {
492  $subs = ilObjRole::getSubObjects('root', false);
493  }
494  } else {
495  $subs = ilObjRole::getSubObjects($this->getParentType(), $a_show_admin_permissions);
496  }
497 
498  foreach ($subs as $subtype => $def) {
500  $this,
501  'perm',
502  $this->getParentRefId(),
503  $this->object->getId(),
504  $subtype,
505  $a_show_admin_permissions
506  );
507  $tbl->parse();
508 
509  $acc->addItem($def['translation'], $tbl->getHTML());
510  }
511 
512  $this->tpl->setVariable('ACCORDION', $acc->getHTML());
513 
514  // Add options table
516  $this,
517  'perm',
518  $this->obj_ref_id,
519  $this->object->getId(),
520  $a_show_admin_permissions
521  );
522  if ($this->object->getId() != SYSTEM_ROLE_ID) {
523  $options->addMultiCommand(
524  $a_show_admin_permissions ? 'adminPermSave' : 'permSave',
525  $this->lng->txt('save')
526  );
527  }
528 
529  $options->parse();
530  $this->tpl->setVariable('OPTIONS_TABLE', $options->getHTML());
531  }
const SYSTEM_ROLE_ID
Definition: constants.php:29
checkAccess(string $a_perm_global, string $a_perm_obj='')
getParentType()
get type of current object (not role folder)
const ROLE_FOLDER_ID
Definition: constants.php:34
getParentRefId()
Get ref id of current object (not role folder id)
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)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ permSaveObject()

ilObjRoleGUI::permSaveObject ( bool  $a_show_admin_permissions = false)

save permissions public

Definition at line 630 of file class.ilObjRoleGUI.php.

References $obj_ref_id, ilRbacLog\add(), checkAccess(), ILIAS\Repository\ctrl(), ilRbacLog\diffTemplate(), ilRbacLog\EDIT_TEMPLATE, ilRbacLog\gatherTemplate(), getParentType(), ILIAS\FileDelivery\http(), ilRbacLog\isActive(), isChangeExistingObjectsConfirmationRequired(), ILIAS\Repository\lng(), ilObjRole\MODE_PROTECTED_KEEP_LOCAL_POLICIES, ilObjRole\MODE_UNPROTECTED_KEEP_LOCAL_POLICIES, ILIAS\Repository\object(), ILIAS\Repository\refinery(), retrieveTemplatePermissionsFromPost(), ROLE_FOLDER_ID, ROOT_FOLDER_ID, showChangeExistingObjectsConfirmation(), and ilUtil\tf2yn().

Referenced by adminPermSaveObject().

630  : void
631  {
632  if (!$this->checkAccess('visible,write', 'edit_permission')) {
633  $this->tpl->setOnScreenMessage('msg_no_perm_perm', $this->lng->txt('permission_denied'), true);
634  $this->ctrl->redirectByClass(ilRepositoryGUI::class);
635  }
636 
637  // rbac log
638  $rbac_log_active = ilRbacLog::isActive();
639  if ($rbac_log_active) {
640  $rbac_log_old = ilRbacLog::gatherTemplate($this->obj_ref_id, $this->object->getId());
641  }
642 
643  // delete all template entries of enabled types
644  if ($this->obj_ref_id == ROLE_FOLDER_ID) {
645  if ($a_show_admin_permissions) {
646  $subs = ilObjRole::getSubObjects('adm', true);
647  } else {
648  $subs = ilObjRole::getSubObjects('root', false);
649  }
650  } else {
651  $subs = ilObjRole::getSubObjects($this->getParentType(), $a_show_admin_permissions);
652  }
653 
654  foreach (array_keys($subs) as $subtype) {
655  // Delete per object type
656  $this->rbac_admin->deleteRolePermission($this->object->getId(), $this->obj_ref_id, $subtype);
657  }
658 
659  $template_permissions = $this->retrieveTemplatePermissionsFromPost();
660  foreach ($template_permissions as $key => $ops_array) {
661  // sets new template permissions
662  $this->rbac_admin->setRolePermission($this->object->getId(), $key, $ops_array, $this->obj_ref_id);
663  }
664 
665  if ($rbac_log_active) {
666  $rbac_log_new = ilRbacLog::gatherTemplate($this->obj_ref_id, $this->object->getId());
667  $rbac_log_diff = ilRbacLog::diffTemplate($rbac_log_old, $rbac_log_new);
668  ilRbacLog::add(ilRbacLog::EDIT_TEMPLATE, $this->obj_ref_id, $rbac_log_diff);
669  }
670 
671  // update object data entry (to update last modification date)
672  $this->object->update();
673 
674  // set protected flag
675  $protected = false;
676  if ($this->http->wrapper()->post()->has('protected')) {
677  $protected = $this->http->wrapper()->post()->retrieve(
678  'protected',
679  $this->refinery->kindlyTo()->bool()
680  );
681  }
682  if (
683  $this->obj_ref_id == ROLE_FOLDER_ID ||
684  $this->rbac_review->isAssignable($this->object->getId(), $this->obj_ref_id)) {
685  $this->rbac_admin->setProtected($this->obj_ref_id, $this->object->getId(), ilUtil::tf2yn($protected));
686  }
687  $recursive = false;
688  if ($this->http->wrapper()->post()->has('recursive')) {
689  $recursive = $this->http->wrapper()->post()->retrieve(
690  'recursive',
691  $this->refinery->kindlyTo()->bool()
692  );
693  }
694  // aka change existing object for specific object types
695  $recursive_list = [];
696  if ($this->http->wrapper()->post()->has('recursive_list')) {
697  $recursive_list = $this->http->wrapper()->post()->retrieve(
698  'recursive_list',
699  $this->refinery->kindlyTo()->listOf(
700  $this->refinery->kindlyTo()->string()
701  )
702  );
703  }
704  if ($a_show_admin_permissions) {
705  $recursive = true;
706  }
707 
708  // Redirect if Change existing objects is not chosen
709  if (!$recursive && !count($recursive_list)) {
710  $this->tpl->setOnScreenMessage('success', $this->lng->txt("saved_successfully"), true);
711  if ($a_show_admin_permissions) {
712  $this->ctrl->redirect($this, 'adminPerm');
713  } else {
714  $this->ctrl->redirect($this, 'perm');
715  }
716  }
717  // New implementation
718  if (
719  ($recursive || count($recursive_list)) &&
721  !$a_show_admin_permissions
722  ) {
723  $this->showChangeExistingObjectsConfirmation($recursive, $recursive_list);
724  return;
725  }
726 
727  $start = ($this->obj_ref_id == ROLE_FOLDER_ID ? ROOT_FOLDER_ID : $this->obj_ref_id);
728  if ($a_show_admin_permissions) {
729  $start = $this->tree->getParentId($this->obj_ref_id);
730  }
731 
732  if ($protected) {
733  $this->object->changeExistingObjects(
734  $start,
736  ['all'],
737  []
738  );
739  } else {
740  $this->object->changeExistingObjects(
741  $start,
743  ['all'],
744  []
745  );
746  }
747  $this->tpl->setOnScreenMessage('success', $this->lng->txt("saved_successfully"), true);
748 
749  if ($a_show_admin_permissions) {
750  $this->ctrl->redirect($this, 'adminPerm');
751  } else {
752  $this->ctrl->redirect($this, 'perm');
753  }
754  }
const ROOT_FOLDER_ID
Definition: constants.php:32
checkAccess(string $a_perm_global, string $a_perm_obj='')
static isActive()
showChangeExistingObjectsConfirmation(bool $recursive, array $recursive_list)
Show confirmation screen.
static tf2yn(bool $a_tf)
const MODE_PROTECTED_KEEP_LOCAL_POLICIES
static gatherTemplate(int $role_ref_id, int $role_id)
static http()
Fetches the global http state from ILIAS.
isChangeExistingObjectsConfirmationRequired()
Check if a confirmation about further settings is required or not.
getParentType()
get type of current object (not role folder)
const ROLE_FOLDER_ID
Definition: constants.php:34
static add(int $action, int $ref_id, array $diff, bool $source_ref_id=false)
const MODE_UNPROTECTED_KEEP_LOCAL_POLICIES
static diffTemplate(array $old, array $new)
const EDIT_TEMPLATE
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ retrieveTemplatePermissionsFromPost()

ilObjRoleGUI::retrieveTemplatePermissionsFromPost ( )
protected

Definition at line 170 of file class.ilObjRoleGUI.php.

References ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

Referenced by permSaveObject().

170  : array
171  {
172  $template_permissions = [];
173  if ($this->http->wrapper()->post()->has('template_perm')) {
174  $custom_transformer = $this->refinery->custom()->transformation(
175  function ($array) {
176  return $array;
177  }
178  );
179  $template_permissions = $this->http->wrapper()->post()->retrieve(
180  'template_perm',
181  $custom_transformer
182  );
183  }
184  return $template_permissions;
185  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveObject()

ilObjRoleGUI::saveObject ( )

Save new role.

Returns

Definition at line 338 of file class.ilObjRoleGUI.php.

References ilObjectGUI\$data, $obj_ref_id, ILIAS\Repository\ctrl(), getRoleForm(), ILIAS\Repository\lng(), and null.

338  : void
339  {
340  $form = $this->getRoleForm(true)->withRequest($this->request);
341  $data = $form->getData();
342  if ($data === null) {
343  $this->tabs_gui->setBackTarget(
344  $this->lng->txt('cancel'),
345  $this->ctrl->getParentReturnByClass(self::class)
346  );
347  $this->tpl->setContent(
348  $this->ui_renderer->render(
349  $this->ui_factory->panel()->standard(
350  $this->lng->txt('role_new'),
351  $form
352  )
353  )
354  );
355  return;
356  }
357 
358  $role = new ilObjRole();
359  $role->setTitle($data[self::FORM_KEY_TITLE]);
360  $role->setDescription($data[self::FORM_KEY_DESCRIPTION]);
361  $role->setAllowRegister($data[self::FORM_KEY_ON_REGISTRATION_FORM]);
362  $role->toggleAssignUsersStatus($data[self::FORM_KEY_ALLOW_LOCAL_USER_ASSIGNMENT]);
363  $role->create();
364  $this->rbac_admin->assignRoleToFolder($role->getId(), $this->obj_ref_id, 'y');
365  $this->rbac_admin->setProtected(
366  $this->obj_ref_id,
367  $role->getId(),
368  $data[self::FORM_KEY_PROTECT] ? 'y' : 'n'
369  );
370  $this->tpl->setOnScreenMessage('success', $this->lng->txt('role_added'), true);
371  $this->ctrl->setParameter($this, 'obj_id', $role->getId());
372  $this->ctrl->redirect($this, 'perm');
373  }
Class ilObjRole.
getRoleForm(bool $is_role_creation_form=false)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ setSubTabs()

ilObjRoleGUI::setSubTabs (   $a_tab)
protected

Definition at line 1219 of file class.ilObjRoleGUI.php.

References ILIAS\Repository\ctrl(), and ROLE_FOLDER_ID.

Referenced by permObject().

1219  : void
1220  {
1221  switch ($a_tab) {
1222  case 'default_perm_settings':
1223  if ($this->obj_ref_id != ROLE_FOLDER_ID) {
1224  return;
1225  }
1226  $this->tabs_gui->addSubTabTarget(
1227  'rbac_repository_permissions',
1228  $this->ctrl->getLinkTarget($this, 'perm')
1229  );
1230  $this->tabs_gui->addSubTabTarget(
1231  'rbac_admin_permissions',
1232  $this->ctrl->getLinkTarget($this, 'adminPerm')
1233  );
1234  }
1235  }
const ROLE_FOLDER_ID
Definition: constants.php:34
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showChangeExistingObjectsConfirmation()

ilObjRoleGUI::showChangeExistingObjectsConfirmation ( bool  $recursive,
array  $recursive_list 
)
protected

Show confirmation screen.

Parameters
string[]$recursive_list

Definition at line 1133 of file class.ilObjRoleGUI.php.

References ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ilObjRole\MODE_PROTECTED_DELETE_LOCAL_POLICIES, ilObjRole\MODE_PROTECTED_KEEP_LOCAL_POLICIES, ilObjRole\MODE_UNPROTECTED_DELETE_LOCAL_POLICIES, ilObjRole\MODE_UNPROTECTED_KEEP_LOCAL_POLICIES, ILIAS\Repository\refinery(), ilRadioGroupInputGUI\setValue(), and ilRadioOption\setValue().

Referenced by permSaveObject().

1133  : void
1134  {
1135  $protected = false;
1136  if ($this->http->wrapper()->post()->has('protected')) {
1137  $protected = $this->http->wrapper()->post()->retrieve(
1138  'protected',
1139  $this->refinery->kindlyTo()->bool()
1140  );
1141  }
1142  $form = new ilPropertyFormGUI();
1143  $form->setFormAction($this->ctrl->getFormAction($this, 'changeExistingObjects'));
1144  $form->setTitle($this->lng->txt('rbac_change_existing_confirm_tbl'));
1145 
1146  $form->addCommandButton('changeExistingObjects', $this->lng->txt('change_existing_objects'));
1147  $form->addCommandButton('perm', $this->lng->txt('cancel'));
1148 
1149  $hidden = new ilHiddenInputGUI('type_filter');
1150  $hidden->setValue($recursive ? json_encode(['all']) : json_encode($recursive_list));
1151  $form->addItem($hidden);
1152 
1153  $rad = new ilRadioGroupInputGUI($this->lng->txt('rbac_local_policies'), 'mode');
1154 
1155  if ($protected) {
1157  $keep = new ilRadioOption(
1158  $this->lng->txt('rbac_keep_local_policies'),
1160  $this->lng->txt('rbac_keep_local_policies_info')
1161  );
1162  } else {
1164  $keep = new ilRadioOption(
1165  $this->lng->txt('rbac_keep_local_policies'),
1166  (string) ilObjRole::MODE_UNPROTECTED_KEEP_LOCAL_POLICIES,
1167  $this->lng->txt('rbac_unprotected_keep_local_policies_info')
1168  );
1169  }
1170  $rad->addOption($keep);
1171 
1172  if ($protected) {
1173  $del = new ilRadioOption(
1174  $this->lng->txt('rbac_delete_local_policies'),
1175  (string) ilObjRole::MODE_PROTECTED_DELETE_LOCAL_POLICIES,
1176  $this->lng->txt('rbac_delete_local_policies_info')
1177  );
1178  } else {
1179  $del = new ilRadioOption(
1180  $this->lng->txt('rbac_delete_local_policies'),
1182  $this->lng->txt('rbac_unprotected_delete_local_policies_info')
1183  );
1184  }
1185  $rad->addOption($del);
1186 
1187  $form->addItem($rad);
1188  $this->tpl->setContent($form->getHTML());
1189  }
This class represents an option in a radio group.
const MODE_PROTECTED_DELETE_LOCAL_POLICIES
const MODE_PROTECTED_KEEP_LOCAL_POLICIES
This class represents a hidden form property in a property form.
static http()
Fetches the global http state from ILIAS.
This class represents a property in a property form.
setValue(string $a_value)
const MODE_UNPROTECTED_DELETE_LOCAL_POLICIES
const MODE_UNPROTECTED_KEEP_LOCAL_POLICIES
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showDefaultPermissionSettings()

ilObjRoleGUI::showDefaultPermissionSettings ( )
protected

check if default permissions are shown or not

Definition at line 230 of file class.ilObjRoleGUI.php.

References getContainerType().

Referenced by executeCommand(), and getTabs().

230  : bool
231  {
232  return $this->obj_definition->isContainer($this->getContainerType())
233  || $this->obj_definition->isAdministrationObject($this->getContainerType());
234  }
getContainerType()
Get type of role container.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateObject()

ilObjRoleGUI::updateObject ( )

Save role settings.

Returns

Definition at line 379 of file class.ilObjRoleGUI.php.

References ilObjectGUI\$data, buildEditPage(), ILIAS\Repository\ctrl(), getRoleForm(), ILIAS\Repository\lng(), null, and ILIAS\Repository\object().

379  : void
380  {
381  $form = $this->getRoleForm()->withRequest($this->request);
382  $data = $form->getData();
383  if ($data === null) {
384  $this->buildEditPage($form);
385  return;
386  }
387 
388  if (isset($data[self::FORM_KEY_TITLE])) {
389  $this->object->setTitle($data[self::FORM_KEY_TITLE]);
390  }
391  if (isset($data[self::FORM_KEY_DESCRIPTION])) {
392  $this->object->setDescription($data[self::FORM_KEY_DESCRIPTION]);
393  }
394  if (isset($data[self::FORM_KEY_ON_REGISTRATION_FORM])) {
395  $this->object->setAllowRegister($data[self::FORM_KEY_ON_REGISTRATION_FORM]);
396  }
397  if (isset($data[self::FORM_KEY_ALLOW_LOCAL_USER_ASSIGNMENT])) {
398  $this->object->toggleAssignUsersStatus($data[self::FORM_KEY_ALLOW_LOCAL_USER_ASSIGNMENT]);
399  }
400  $this->object->update();
401  $this->rbac_admin->setProtected(
402  $this->obj_ref_id,
403  $this->object->getId(),
404  $data[self::FORM_KEY_PROTECT] ? 'y' : 'n'
405  );
406 
407  $this->tpl->setOnScreenMessage('success', $this->lng->txt('saved_successfully'), true);
408  $this->ctrl->redirect($this, 'edit');
409  }
getRoleForm(bool $is_role_creation_form=false)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
buildEditPage(?StandardForm $form=null)
+ Here is the call graph for this function:

◆ userassignmentObject()

ilObjRoleGUI::userassignmentObject ( )

display user assignment panel

Definition at line 926 of file class.ilObjRoleGUI.php.

References ilSecuritySettings\_getInstance(), checkAccess(), ILIAS\Repository\ctrl(), ilRepositorySearchGUI\fillAutoCompleteToolbar(), ilObjectGUI\getAdminMode(), ILIAS\Repository\lng(), ILIAS\Repository\object(), SYSTEM_ROLE_ID, and ILIAS\Repository\user().

926  : void
927  {
928  if (!$this->checkAccess('edit_userassignment', 'edit_permission')) {
929  $this->tpl->setOnScreenMessage(
930  $this->lng->txt("msg_no_perm_assign_user_to_role"),
931  );
932  return;
933  }
934 
935  $this->tabs_gui->setTabActive('user_assignment');
936 
937  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.rbac_ua.html', 'components/ILIAS/AccessControl');
938 
939  $tb = new ilToolbarGUI();
940 
941  // protected admin role
942  if ($this->object->getId() != SYSTEM_ROLE_ID
943  || ($this->rbac_review->isAssigned($this->user->getId(), SYSTEM_ROLE_ID)
944  || !ilSecuritySettings::_getInstance()->isAdminRoleProtected())) {
945  // add member
947  $this,
948  $tb,
949  [
950  'auto_complete_name' => $this->lng->txt('user'),
951  'submit_name' => $this->lng->txt('add')
952  ]
953  );
954 
955  $tb->addSpacer();
956 
957  $tb->addComponent(
958  $this->ui_factory->link()->standard(
959  $this->lng->txt('search_user'),
960  $this->ctrl->getLinkTargetByClass('ilRepositorySearchGUI', 'start')
961  )
962  );
963  $tb->addSpacer();
964  }
965 
966  $tb->addComponent(
967  $this->ui_factory->link()->standard(
968  $this->lng->txt('role_mailto'),
969  $this->ctrl->getLinkTarget($this, 'mailToRole')
970  )
971  );
972  $this->tpl->setVariable('BUTTONS_UA', $tb->getHTML());
973 
974  $role_assignment_editable = true;
975  if (
976  $this->object->getId() == SYSTEM_ROLE_ID &&
977  !ilSecuritySettings::_getInstance()->checkAdminRoleAccessible($this->user->getId())) {
978  $role_assignment_editable = false;
979  }
980  $ut = new ilAssignedUsersTableGUI(
981  $this,
982  'userassignment',
983  $this->ui_factory,
984  $this->ui_renderer,
985  $this->object->getId(),
986  $role_assignment_editable,
987  $this->getAdminMode() === self::ADMIN_MODE_SETTINGS
988  );
989  $this->tpl->setVariable('TABLE_UA', $ut->getHTML());
990  }
const SYSTEM_ROLE_ID
Definition: constants.php:29
checkAccess(string $a_perm_global, string $a_perm_obj='')
static fillAutoCompleteToolbar(object $parent_object, ?ilToolbarGUI $toolbar=null, array $a_options=[], bool $a_sticky=false)
array( auto_complete_name = $lng->txt(&#39;user&#39;), auto_complete_size = 15, user_type = array(ilCoursePar...
TableGUI class for role administration.
static _getInstance()
Get instance of ilSecuritySettings.
+ Here is the call graph for this function:

Field Documentation

◆ $container_type

string ilObjRoleGUI::$container_type = ''
protected

Definition at line 48 of file class.ilObjRoleGUI.php.

Referenced by getContainerType().

◆ $help

ilHelpGUI ilObjRoleGUI::$help
protected

Definition at line 50 of file class.ilObjRoleGUI.php.

◆ $http

GlobalHttpState ilObjRoleGUI::$http
private

Definition at line 52 of file class.ilObjRoleGUI.php.

◆ $logger

ilLogger ilObjRoleGUI::$logger
private

Definition at line 51 of file class.ilObjRoleGUI.php.

◆ $obj_obj_id

int ilObjRoleGUI::$obj_obj_id = 0
protected

Definition at line 46 of file class.ilObjRoleGUI.php.

Referenced by getParentObjId().

◆ $obj_obj_type

string ilObjRoleGUI::$obj_obj_type = ''
protected

Definition at line 47 of file class.ilObjRoleGUI.php.

Referenced by getParentType().

◆ $obj_ref_id

◆ $refinery

Factory ilObjRoleGUI::$refinery
protected

Definition at line 53 of file class.ilObjRoleGUI.php.

◆ $role_id

int ilObjRoleGUI::$role_id = 0
protected

Definition at line 49 of file class.ilObjRoleGUI.php.

Referenced by getRoleId().

◆ $ui_factory

UIFactory ilObjRoleGUI::$ui_factory
protected

Definition at line 54 of file class.ilObjRoleGUI.php.

◆ $ui_renderer

Renderer ilObjRoleGUI::$ui_renderer
protected

Definition at line 55 of file class.ilObjRoleGUI.php.

◆ FORM_KEY_ALLOW_LOCAL_USER_ASSIGNMENT

const ilObjRoleGUI::FORM_KEY_ALLOW_LOCAL_USER_ASSIGNMENT = 'allow_local_user_assignment'
private

Definition at line 42 of file class.ilObjRoleGUI.php.

◆ FORM_KEY_DESCRIPTION

const ilObjRoleGUI::FORM_KEY_DESCRIPTION = 'description'
private

Definition at line 39 of file class.ilObjRoleGUI.php.

◆ FORM_KEY_ILIAS_ID

const ilObjRoleGUI::FORM_KEY_ILIAS_ID = 'ilias_id'
private

Definition at line 40 of file class.ilObjRoleGUI.php.

◆ FORM_KEY_ON_REGISTRATION_FORM

const ilObjRoleGUI::FORM_KEY_ON_REGISTRATION_FORM = 'on_registration_form'
private

Definition at line 41 of file class.ilObjRoleGUI.php.

◆ FORM_KEY_PROTECT

const ilObjRoleGUI::FORM_KEY_PROTECT = 'protect'
private

Definition at line 43 of file class.ilObjRoleGUI.php.

◆ FORM_KEY_TITLE

const ilObjRoleGUI::FORM_KEY_TITLE = 'title'
private

Definition at line 38 of file class.ilObjRoleGUI.php.


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