ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
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
 
GlobalHttpState $http
 
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
 
CustomIconFactory $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
 

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 993 of file class.ilObjRoleGUI.php.

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

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

◆ addLocatorItems()

ilObjRoleGUI::addLocatorItems ( )
protected

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

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

1265  : void
1266  {
1267  if ($this->getAdminMode() === self::ADMIN_MODE_NONE || $this->getAdminMode() === self::ADMIN_MODE_REPOSITORY) {
1268  $this->ctrl->setParameterByClass(
1269  "ilobjrolegui",
1270  "obj_id",
1271  $this->getRoleId()
1272  );
1273  $this->locator->addItem(
1274  ilObjRole::_getTranslation($this->object->getTitle()),
1275  $this->ctrl->getLinkTargetByClass(
1276  [
1277  "ilpermissiongui",
1278  "ilobjrolegui"
1279  ],
1280  "perm"
1281  )
1282  );
1283  }
1284  }
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 1238 of file class.ilObjRoleGUI.php.

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

1238  : void
1239  {
1240  $users = [];
1241  if ($this->http->wrapper()->post()->has('user_id')) {
1242  $users = $this->http->wrapper()->post()->retrieve(
1243  'user_id',
1244  $this->refinery->kindlyTo()->listOf(
1245  $this->refinery->kindlyTo()->int()
1246  )
1247  );
1248  }
1249  if (count($users) === 0) {
1250  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'), true);
1251  $this->ctrl->redirect($this, 'userassignment');
1252  }
1253  $clip = ilUserClipboard::getInstance($this->user->getId());
1254  $clip->add($users);
1255  $clip->save();
1256 
1257  $this->lng->loadLanguageModule('user');
1258  $this->tpl->setOnScreenMessage('success', $this->lng->txt('clipboard_user_added'), true);
1259  $this->ctrl->redirect($this, 'userassignment');
1260  }
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 803 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.

803  : void
804  {
805  if (!$this->checkAccess('edit_userassignment', 'edit_permission')) {
806  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('msg_no_perm_assign_user_to_role'), true);
807  return;
808  }
809  if (!$this->rbac_review->isAssignable($this->object->getId(), $this->obj_ref_id) &&
810  $this->obj_ref_id != ROLE_FOLDER_ID) {
811  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('err_role_not_assignable'), true);
812  return;
813  }
814  if ($a_user_ids === []) {
815  $this->lng->loadLanguageModule('search');
816  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('search_err_user_not_exist'), true);
817  return;
818  }
819 
820  $assigned_users_all = $this->rbac_review->assignedUsers($this->object->getId());
821 
822  // users to assign
823  $assigned_users_new = array_diff($a_user_ids, array_intersect($a_user_ids, $assigned_users_all));
824 
825  // selected users all already assigned. stop
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');
829  }
830 
831  // assign new users
832  foreach ($assigned_users_new as $user_id) {
833  if ($user_id === ANONYMOUS_USER_ID) {
834  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('msg_anonymous_cannot_be_assigned'), true);
835  return;
836  }
837  $this->rbac_admin->assignUser($this->object->getId(), $user_id, false);
838  }
839 
840  // update object data entry (to update last modification date)
841  $this->object->update();
842 
843  $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_userassignment_changed"), true);
844  $this->ctrl->redirect($this, 'userassignment');
845  }
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 531 of file class.ilObjRoleGUI.php.

References permObject().

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

◆ adminPermSaveObject()

ilObjRoleGUI::adminPermSaveObject ( )
protected

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

References permSaveObject().

536  : void
537  {
538  $this->permSaveObject(true);
539  }
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 541 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().

541  : void
542  {
543  $output = [];
544  $parent_role_ids = $this->rbac_review->getParentRoleIds($this->obj_ref_id, true);
545 
546  $this->tabs_gui->clearTargets();
547 
548  $ids = [];
549  foreach (array_keys($parent_role_ids) as $id) {
550  $ids[] = $id;
551  }
552  // Sort ids
553  $sorted_ids = ilUtil::_sortIds($ids, 'object_data', 'type,title', 'obj_id');
554  $key = 0;
555  foreach ($sorted_ids as $id) {
556  $par = $parent_role_ids[$id];
557  if ($par["obj_id"] != SYSTEM_ROLE_ID && $this->object->getId() != $par["obj_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'));
560  $output[$key]["role_name"] = ilObjRole::_getTranslation($par["title"]);
561  $output[$key]["role_desc"] = $par["desc"];
562  $key++;
563  }
564  }
565 
566  $tbl = new ilRoleAdoptPermissionTableGUI($this, "adoptPerm");
567  $tbl->setTitle($this->lng->txt("adopt_perm_from_template"));
568  $tbl->setData($output);
569 
570  $this->tpl->setContent($tbl->getHTML());
571  }
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 754 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().

754  : void
755  {
756  $source = 0;
757  if ($this->http->wrapper()->post()->has('adopt')) {
758  $source = $this->http->wrapper()->post()->retrieve(
759  'adopt',
760  $this->refinery->kindlyTo()->int()
761  );
762  }
763 
764  if (!$source) {
765  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'));
766  $this->adoptPermObject();
767  return;
768  }
769 
770  $access = $this->checkAccess('visible,write', 'edit_permission');
771  if (!$access) {
772  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('msg_no_perm_perm'), true);
773  }
774  if ($this->object->getId() == $source) {
775  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("msg_perm_adopted_from_itself"), true);
776  } else {
777  $this->rbac_admin->deleteRolePermission($this->object->getId(), $this->obj_ref_id);
778  $parentRoles = $this->rbac_review->getParentRoleIds($this->obj_ref_id, true);
779  $this->rbac_admin->copyRoleTemplatePermissions(
780  $source,
781  $parentRoles[$source]["parent"],
782  $this->obj_ref_id,
783  $this->object->getId(),
784  false
785  );
786 
787  // update object data entry (to update last modification date)
788  $this->object->update();
789 
790  // send info
791  $title = ilObject::_lookupTitle($source);
792  $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_perm_adopted_from1") . " '" .
793  ilObjRole::_getTranslation($title) . "'.<br/>" .
794  $this->lng->txt("msg_perm_adopted_from2"), true);
795  }
796 
797  $this->ctrl->redirect($this, "perm");
798  }
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 1318 of file class.ilObjRoleGUI.php.

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

Referenced by buildEditPage(), and permObject().

1319  {
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'));
1323  }
1324  return $this->ui_factory->modal()->interruptive(
1325  $this->lng->txt('confirm'),
1326  $message,
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()
1332  )
1333  ]);
1334  }
$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 409 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().

409  : void
410  {
411  $page_content = [];
412  if ($this->object->getId() != SYSTEM_ROLE_ID) {
413  $this->toolbar->setFormAction($this->ctrl->getFormAction($this));
414  if ($this->rbac_review->isDeleteable($this->object->getId(), $this->obj_ref_id)) {
415  $modal = $this->buildConfirmationModal();
416  $this->toolbar->addComponent(
417  $this->ui_factory->button()->standard(
418  $this->lng->txt('rbac_delete_role'),
419  $modal->getShowSignal()
420  )
421  );
422  $page_content[] = $modal;
423  }
424  }
425 
426  $page_content[] = $this->ui_factory->panel()->standard(
427  $this->lng->txt('role_edit'),
428  $form ?? $this->getRoleForm()
429  );
430 
431  $this->tpl->setContent(
432  $this->ui_renderer->render($page_content)
433  );
434  }
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 1189 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.

1189  : void
1190  {
1191  $mode = 0;
1192  if ($this->http->wrapper()->post()->has('mode')) {
1193  $mode = $this->http->wrapper()->post()->retrieve(
1194  'mode',
1195  $this->refinery->kindlyTo()->int()
1196  );
1197  }
1198  $start = ($this->obj_ref_id == ROLE_FOLDER_ID ? ROOT_FOLDER_ID : $this->obj_ref_id);
1199 
1200  $type_filter = [];
1201  if ($this->http->wrapper()->post()->has('type_filter')) {
1202  $serialized_type_filter = $this->http->wrapper()->post()->retrieve(
1203  'type_filter',
1204  $this->refinery->kindlyTo()->string()
1205  );
1206  $type_filter = json_decode(
1207  $serialized_type_filter,
1208  true
1209  );
1210  }
1211 
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');
1215  }
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 1099 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().

1099  : bool
1100  {
1101  $a_perm_obj = $a_perm_obj ?: $a_perm_global;
1102 
1103  if ($this->obj_ref_id == ROLE_FOLDER_ID) {
1104  return $this->rbac_system->checkAccess($a_perm_global, $this->obj_ref_id);
1105  } else {
1106  return $this->access->checkAccess($a_perm_obj, '', $this->obj_ref_id);
1107  }
1108  }
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 576 of file class.ilObjRoleGUI.php.

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

576  : void
577  {
578  $this->tabs_gui->clearTargets();
579 
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);
583  }
584 
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'));
588  }
589  $this->tpl->setOnScreenMessage('question', $question);
590 
591  $confirm = new ilConfirmationGUI();
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');
596 
597  $confirm->addItem(
598  'role',
599  (string) $this->object->getId(),
600  ilObjRole::_getTranslation($this->object->getTitle()),
601  ilUtil::getImagePath('standard/icon_role.svg')
602  );
603 
604  $this->tpl->setContent($confirm->getHTML());
605  }
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 299 of file class.ilObjRoleGUI.php.

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

299  : void
300  {
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);
304  }
305 
306  $this->tabs_gui->setBackTarget(
307  $this->lng->txt('cancel'),
308  $this->ctrl->getParentReturnByClass(self::class)
309  );
310 
311  $this->tpl->setContent(
312  $this->ui_renderer->render(
313  $this->ui_factory->panel()->standard(
314  $this->lng->txt('role_new'),
315  $this->getRoleForm(true)
316  )
317  )
318  );
319  }
getRoleForm(bool $is_role_creation_form=false)
+ Here is the call graph for this function:

◆ deassignUserObject()

ilObjRoleGUI::deassignUserObject ( )

Definition at line 847 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.

847  : void
848  {
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
853  );
854  }
855 
856  $selected_users = [];
857  if ($this->http->wrapper()->query()->has('user_id')) {
858  $selected_users = [
859  $this->http->wrapper()->query()->retrieve(
860  'user_id',
861  $this->refinery->kindlyTo()->int()
862  )
863  ];
864  }
865  if ($this->http->wrapper()->post()->has('user_id')) {
866  $selected_users = $this->http->wrapper()->post()->retrieve(
867  'user_id',
868  $this->refinery->kindlyTo()->listOf(
869  $this->refinery->kindlyTo()->int()
870  )
871  );
872  }
873  if (count($selected_users) === 0) {
874  $this->ilias->raiseError($this->lng->txt("no_checkbox"), $this->ilias->error_obj->MESSAGE);
875  }
876 
877  // prevent unassignment of system user from system role
878  if ($this->object->getId() == SYSTEM_ROLE_ID) {
879  if ($admin = array_search(SYSTEM_USER_ID, $selected_users) !== false) {
880  unset($selected_users[$admin]);
881  }
882  }
883 
884  // check for each user if the current role is his last global role before deassigning him
885  $last_role = [];
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);
890 
891  if (count($assigned_roles) == 1 || count($assigned_global_roles) == 1 && in_array(
892  $this->object->getId(),
893  $assigned_global_roles
894  )) {
895  $userObj = new ilObjUser($user);
896  $last_role[$user] = $userObj->getFullName();
897  unset($userObj);
898  }
899  }
900 
901  // ... else perform deassignment
902  foreach ($selected_users as $user) {
903  if (!isset($last_role[$user])) {
904  $this->rbac_admin->deassignUser($this->object->getId(), $user);
905  }
906  }
907 
908  // update object data entry (to update last modification date)
909  $this->object->update();
910 
911  // raise error if last role was taken from a user...
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);
915  } else {
916  $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_userassignment_changed"), true);
917  }
918  $this->ctrl->redirect($this, 'userassignment');
919  }
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 321 of file class.ilObjRoleGUI.php.

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

321  : void
322  {
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);
326  }
327  $this->tabs_gui->activateTab('edit_properties');
328 
329  $this->buildEditPage();
330  }
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 1290 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().

1290  : bool
1291  {
1292  // creation of roles
1293  if (
1294  !$this->object->getId() ||
1295  $this->object->getId() == ROLE_FOLDER_ID
1296  ) {
1297  return true;
1298  }
1299 
1300  $possible_roles = [];
1301  try {
1302  $possible_roles = $this->rbac_review->getRolesOfObject(
1303  $this->obj_ref_id,
1304  false
1305  );
1306  } catch (\InvalidArgumentException $e) {
1307  $this->logger->warning('Role access check failed: ' . $e);
1308  throw new \ilObjectException($this->lng->txt('permission_denied'));
1309  }
1310 
1311  if (!in_array($this->object->getId(), $possible_roles)) {
1312  $this->logger->warning('Object id: ' . $this->object->getId() . ' is not accessible for ref_id: ' . $this->obj_ref_id);
1313  throw new \ilObjectException($this->lng->txt('permission_denied'));
1314  }
1315  return true;
1316  }
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 85 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().

85  : void
86  {
87  $this->prepareOutput();
88 
89  $next_class = $this->ctrl->getNextClass($this);
90  $cmd = $this->ctrl->getCmd();
91 
93 
94  switch ($next_class) {
95  case 'ilrepositorysearchgui':
96 
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
101  );
102  }
103  $rep_search = new ilRepositorySearchGUI();
104  $rep_search->setTitle($this->lng->txt('role_add_user'));
105  $rep_search->setCallback($this, 'addUserObject');
106 
107  // Set tabs
108  $this->tabs_gui->setTabActive('user_assignment');
109  $this->ctrl->setReturn($this, 'userassignment');
110  $ret = $this->ctrl->forwardCommand($rep_search);
111  break;
112 
113  case 'ilexportgui':
114 
115  $this->tabs_gui->setTabActive('export');
116 
118  $eo->addOption(ilExportOptions::KEY_ROOT, 0, $this->object->getId(), $this->obj_ref_id);
119 
120  $exp = new ilExportGUI($this, new ilObjRole($this->object->getId()));
121  $exp->addFormat('xml');
122  $this->ctrl->forwardCommand($exp);
123  break;
124 
125  case 'ilrecommendedcontentroleconfiggui':
126  $this->tabs_gui->setTabActive('rep_recommended_content');
127  $ui = new ilRecommendedContentRoleConfigGUI($this->object->getId(), $this->obj_ref_id);
128  $this->ctrl->forwardCommand($ui);
129  break;
130 
131  default:
132  if (!$cmd) {
133  if ($this->showDefaultPermissionSettings()) {
134  $cmd = "perm";
135  } else {
136  $cmd = 'userassignment';
137  }
138  }
139  $cmd .= "Object";
140  $this->$cmd();
141 
142  break;
143  }
144  }
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 212 of file class.ilObjRoleGUI.php.

References getTabs().

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

◆ getContainerType()

ilObjRoleGUI::getContainerType ( )
protected

Get type of role container.

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

References $container_type.

Referenced by showDefaultPermissionSettings().

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

◆ getParentObjId()

ilObjRoleGUI::getParentObjId ( )

Get obj_id of current object.

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

References $obj_obj_id.

196  : int
197  {
198  return $this->obj_obj_id;
199  }

◆ getParentRefId()

ilObjRoleGUI::getParentRefId ( )

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

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

References $obj_ref_id.

Referenced by permObject().

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

◆ getParentType()

ilObjRoleGUI::getParentType ( )

get type of current object (not role folder)

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

References $obj_obj_type.

Referenced by permObject(), and permSaveObject().

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

◆ getRoleForm()

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

Definition at line 234 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().

234  : StandardForm
235  {
236  if ($this->creation_mode) {
237  $this->ctrl->setParameter($this, 'new_type', 'role');
238  }
239 
240  $ff = $this->ui_factory->input()->field();
241 
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')
245  );
246 
247  $role_is_autogenerated = false;
248 
249  if (!$is_role_creation_form) {
250  $role_is_autogenerated = $this->object->isAutoGenerated();
251  }
252 
253  $inputs = [
254  self::FORM_KEY_TITLE => $ff->text($this->lng->txt('title'))
255  ->withMaxLength(70)
256  ->withRequired(true)
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'))
261  ->withMaxLimit(4000)
262  ->withValue($is_role_creation_form ? '' : $this->object->getDescription())
263  ->withDisabled($role_is_autogenerated),
264 
265  ];
266 
267  if (!$is_role_creation_form) {
268  $inputs[self::FORM_KEY_ILIAS_ID] = $ff->text($this->lng->txt('ilias_id'))
269  ->withDisabled(true)
270  ->withValue('il_' . IL_INST_ID . '_'
271  . $this->object->getType() . '_' . $this->object->getId());
272  }
273 
274  if ($this->obj_ref_id === ROLE_FOLDER_ID) {
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());
279  }
280 
281  $inputs[self::FORM_KEY_PROTECT] = $ff->checkbox($this->lng->txt('role_protect_permissions'))
282  ->withValue(
283  $is_role_creation_form
284  ? false
285  : $this->rbac_review->isProtected($this->obj_ref_id, $this->object->getId())
286  );
287 
288  return $this->ui_factory->input()->container()->form()->standard(
289  $this->ctrl->getFormActionByClass(
290  self::class,
291  $is_role_creation_form ? 'save' : 'update'
292  ),
293  $inputs
294  )->withSubmitLabel(
295  $is_role_creation_form ? $this->lng->txt('role_new') : $this->lng->txt('save')
296  );
297  }
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 146 of file class.ilObjRoleGUI.php.

References $role_id.

Referenced by addLocatorItems().

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

◆ getTabs()

ilObjRoleGUI::getTabs ( )
protected

Definition at line 1014 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().

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

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

151  : void
152  {
153  $this->obj_ref_id = 0;
154 
155  if ($this->http->wrapper()->query()->has('rolf_ref_id')) {
156  $this->obj_ref_id = $this->http->wrapper()->query()->retrieve(
157  'rolf_ref_id',
158  $this->refinery->kindlyTo()->int()
159  );
160  } elseif ($this->http->wrapper()->query()->has('ref_id')) {
161  $this->obj_ref_id = $this->http->wrapper()->query()->retrieve(
162  'ref_id',
163  $this->refinery->kindlyTo()->int()
164  );
165  }
166  }
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 1113 of file class.ilObjRoleGUI.php.

Referenced by permSaveObject().

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

◆ mailToRoleObject()

ilObjRoleGUI::mailToRoleObject ( )

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

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

1084  : void
1085  {
1086  $mail_roles = (array) (ilSession::get('mail_roles') ?? []);
1087 
1088  $obj_ids = ilObject::_getIdsForTitle($this->object->getTitle(), $this->object->getType());
1089  if (count($obj_ids) > 1) {
1090  $mail_roles[] = '#il_role_' . $this->object->getId();
1091  } else {
1092  $mail_roles[] = (new \ilRoleMailboxAddress($this->object->getId()))->value();
1093  }
1094  ilSession::set('mail_roles', $mail_roles);
1095  $script = ilMailFormCall::getRedirectTarget($this, 'userassignment', [], ['type' => 'role']);
1096  ilUtil::redirect($script);
1097  }
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 610 of file class.ilObjRoleGUI.php.

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

610  : void
611  {
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);
615  }
616 
617  $this->object->setParent($this->obj_ref_id);
618  $this->object->delete();
619  $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_deleted_role'), true);
620 
621  $this->ctrl->returnToParent($this);
622  }
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 436 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().

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

628  : void
629  {
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);
633  }
634 
635  // rbac log
636  $rbac_log_active = ilRbacLog::isActive();
637  if ($rbac_log_active) {
638  $rbac_log_old = ilRbacLog::gatherTemplate($this->obj_ref_id, $this->object->getId());
639  }
640 
641  // delete all template entries of enabled types
642  if ($this->obj_ref_id == ROLE_FOLDER_ID) {
643  if ($a_show_admin_permissions) {
644  $subs = ilObjRole::getSubObjects('adm', true);
645  } else {
646  $subs = ilObjRole::getSubObjects('root', false);
647  }
648  } else {
649  $subs = ilObjRole::getSubObjects($this->getParentType(), $a_show_admin_permissions);
650  }
651 
652  foreach (array_keys($subs) as $subtype) {
653  // Delete per object type
654  $this->rbac_admin->deleteRolePermission($this->object->getId(), $this->obj_ref_id, $subtype);
655  }
656 
657  $template_permissions = $this->retrieveTemplatePermissionsFromPost();
658  foreach ($template_permissions as $key => $ops_array) {
659  // sets new template permissions
660  $this->rbac_admin->setRolePermission($this->object->getId(), $key, $ops_array, $this->obj_ref_id);
661  }
662 
663  if ($rbac_log_active) {
664  $rbac_log_new = ilRbacLog::gatherTemplate($this->obj_ref_id, $this->object->getId());
665  $rbac_log_diff = ilRbacLog::diffTemplate($rbac_log_old, $rbac_log_new);
666  ilRbacLog::add(ilRbacLog::EDIT_TEMPLATE, $this->obj_ref_id, $rbac_log_diff);
667  }
668 
669  // update object data entry (to update last modification date)
670  $this->object->update();
671 
672  // set protected flag
673  $protected = false;
674  if ($this->http->wrapper()->post()->has('protected')) {
675  $protected = $this->http->wrapper()->post()->retrieve(
676  'protected',
677  $this->refinery->kindlyTo()->bool()
678  );
679  }
680  if (
681  $this->obj_ref_id == ROLE_FOLDER_ID ||
682  $this->rbac_review->isAssignable($this->object->getId(), $this->obj_ref_id)) {
683  $this->rbac_admin->setProtected($this->obj_ref_id, $this->object->getId(), ilUtil::tf2yn($protected));
684  }
685  $recursive = false;
686  if ($this->http->wrapper()->post()->has('recursive')) {
687  $recursive = $this->http->wrapper()->post()->retrieve(
688  'recursive',
689  $this->refinery->kindlyTo()->bool()
690  );
691  }
692  // aka change existing object for specific object types
693  $recursive_list = [];
694  if ($this->http->wrapper()->post()->has('recursive_list')) {
695  $recursive_list = $this->http->wrapper()->post()->retrieve(
696  'recursive_list',
697  $this->refinery->kindlyTo()->listOf(
698  $this->refinery->kindlyTo()->string()
699  )
700  );
701  }
702  if ($a_show_admin_permissions) {
703  $recursive = true;
704  }
705 
706  // Redirect if Change existing objects is not chosen
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');
711  } else {
712  $this->ctrl->redirect($this, 'perm');
713  }
714  }
715  // New implementation
716  if (
717  ($recursive || count($recursive_list)) &&
719  !$a_show_admin_permissions
720  ) {
721  $this->showChangeExistingObjectsConfirmation($recursive, $recursive_list);
722  return;
723  }
724 
725  $start = ($this->obj_ref_id == ROLE_FOLDER_ID ? ROOT_FOLDER_ID : $this->obj_ref_id);
726  if ($a_show_admin_permissions) {
727  $start = $this->tree->getParentId($this->obj_ref_id);
728  }
729 
730  if ($protected) {
731  $this->object->changeExistingObjects(
732  $start,
734  ['all'],
735  []
736  );
737  } else {
738  $this->object->changeExistingObjects(
739  $start,
741  ['all'],
742  []
743  );
744  }
745  $this->tpl->setOnScreenMessage('success', $this->lng->txt("saved_successfully"), true);
746 
747  if ($a_show_admin_permissions) {
748  $this->ctrl->redirect($this, 'adminPerm');
749  } else {
750  $this->ctrl->redirect($this, 'perm');
751  }
752  }
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 168 of file class.ilObjRoleGUI.php.

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

Referenced by permSaveObject().

168  : array
169  {
170  $template_permissions = [];
171  if ($this->http->wrapper()->post()->has('template_perm')) {
172  $custom_transformer = $this->refinery->custom()->transformation(
173  function ($array) {
174  return $array;
175  }
176  );
177  $template_permissions = $this->http->wrapper()->post()->retrieve(
178  'template_perm',
179  $custom_transformer
180  );
181  }
182  return $template_permissions;
183  }
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 336 of file class.ilObjRoleGUI.php.

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

336  : void
337  {
338  $form = $this->getRoleForm(true)->withRequest($this->request);
339  $data = $form->getData();
340  if ($data === null) {
341  $this->tabs_gui->setBackTarget(
342  $this->lng->txt('cancel'),
343  $this->ctrl->getParentReturnByClass(self::class)
344  );
345  $this->tpl->setContent(
346  $this->ui_renderer->render(
347  $this->ui_factory->panel()->standard(
348  $this->lng->txt('role_new'),
349  $form
350  )
351  )
352  );
353  return;
354  }
355 
356  $role = new ilObjRole();
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]);
361  $role->create();
362  $this->rbac_admin->assignRoleToFolder($role->getId(), $this->obj_ref_id, 'y');
363  $this->rbac_admin->setProtected(
364  $this->obj_ref_id,
365  $role->getId(),
366  $data[self::FORM_KEY_PROTECT] ? 'y' : 'n'
367  );
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');
371  }
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 1217 of file class.ilObjRoleGUI.php.

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

Referenced by permObject().

1217  : void
1218  {
1219  switch ($a_tab) {
1220  case 'default_perm_settings':
1221  if ($this->obj_ref_id != ROLE_FOLDER_ID) {
1222  return;
1223  }
1224  $this->tabs_gui->addSubTabTarget(
1225  'rbac_repository_permissions',
1226  $this->ctrl->getLinkTarget($this, 'perm')
1227  );
1228  $this->tabs_gui->addSubTabTarget(
1229  'rbac_admin_permissions',
1230  $this->ctrl->getLinkTarget($this, 'adminPerm')
1231  );
1232  }
1233  }
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 1131 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().

1131  : void
1132  {
1133  $protected = false;
1134  if ($this->http->wrapper()->post()->has('protected')) {
1135  $protected = $this->http->wrapper()->post()->retrieve(
1136  'protected',
1137  $this->refinery->kindlyTo()->bool()
1138  );
1139  }
1140  $form = new ilPropertyFormGUI();
1141  $form->setFormAction($this->ctrl->getFormAction($this, 'changeExistingObjects'));
1142  $form->setTitle($this->lng->txt('rbac_change_existing_confirm_tbl'));
1143 
1144  $form->addCommandButton('changeExistingObjects', $this->lng->txt('change_existing_objects'));
1145  $form->addCommandButton('perm', $this->lng->txt('cancel'));
1146 
1147  $hidden = new ilHiddenInputGUI('type_filter');
1148  $hidden->setValue($recursive ? json_encode(['all']) : json_encode($recursive_list));
1149  $form->addItem($hidden);
1150 
1151  $rad = new ilRadioGroupInputGUI($this->lng->txt('rbac_local_policies'), 'mode');
1152 
1153  if ($protected) {
1155  $keep = new ilRadioOption(
1156  $this->lng->txt('rbac_keep_local_policies'),
1158  $this->lng->txt('rbac_keep_local_policies_info')
1159  );
1160  } else {
1162  $keep = new ilRadioOption(
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')
1166  );
1167  }
1168  $rad->addOption($keep);
1169 
1170  if ($protected) {
1171  $del = new ilRadioOption(
1172  $this->lng->txt('rbac_delete_local_policies'),
1173  (string) ilObjRole::MODE_PROTECTED_DELETE_LOCAL_POLICIES,
1174  $this->lng->txt('rbac_delete_local_policies_info')
1175  );
1176  } else {
1177  $del = new ilRadioOption(
1178  $this->lng->txt('rbac_delete_local_policies'),
1180  $this->lng->txt('rbac_unprotected_delete_local_policies_info')
1181  );
1182  }
1183  $rad->addOption($del);
1184 
1185  $form->addItem($rad);
1186  $this->tpl->setContent($form->getHTML());
1187  }
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 228 of file class.ilObjRoleGUI.php.

References getContainerType().

Referenced by executeCommand(), and getTabs().

228  : bool
229  {
230  return $this->obj_definition->isContainer($this->getContainerType())
231  || $this->obj_definition->isAdministrationObject($this->getContainerType());
232  }
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 377 of file class.ilObjRoleGUI.php.

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

377  : void
378  {
379  $form = $this->getRoleForm()->withRequest($this->request);
380  $data = $form->getData();
381  if ($data === null) {
382  $this->buildEditPage($form);
383  return;
384  }
385 
386  if (isset($data[self::FORM_KEY_TITLE])) {
387  $this->object->setTitle($data[self::FORM_KEY_TITLE]);
388  }
389  if (isset($data[self::FORM_KEY_DESCRIPTION])) {
390  $this->object->setDescription($data[self::FORM_KEY_DESCRIPTION]);
391  }
392  if (isset($data[self::FORM_KEY_ON_REGISTRATION_FORM])) {
393  $this->object->setAllowRegister($data[self::FORM_KEY_ON_REGISTRATION_FORM]);
394  }
395  if (isset($data[self::FORM_KEY_ALLOW_LOCAL_USER_ASSIGNMENT])) {
396  $this->object->toggleAssignUsersStatus($data[self::FORM_KEY_ALLOW_LOCAL_USER_ASSIGNMENT]);
397  }
398  $this->object->update();
399  $this->rbac_admin->setProtected(
400  $this->obj_ref_id,
401  $this->object->getId(),
402  $data[self::FORM_KEY_PROTECT] ? 'y' : 'n'
403  );
404 
405  $this->tpl->setOnScreenMessage('success', $this->lng->txt('saved_successfully'), true);
406  $this->ctrl->redirect($this, 'edit');
407  }
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 924 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().

924  : void
925  {
926  if (!$this->checkAccess('edit_userassignment', 'edit_permission')) {
927  $this->tpl->setOnScreenMessage(
928  $this->lng->txt("msg_no_perm_assign_user_to_role"),
929  );
930  return;
931  }
932 
933  $this->tabs_gui->setTabActive('user_assignment');
934 
935  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.rbac_ua.html', 'components/ILIAS/AccessControl');
936 
937  $tb = new ilToolbarGUI();
938 
939  // protected admin role
940  if ($this->object->getId() != SYSTEM_ROLE_ID
941  || ($this->rbac_review->isAssigned($this->user->getId(), SYSTEM_ROLE_ID)
942  || !ilSecuritySettings::_getInstance()->isAdminRoleProtected())) {
943  // add member
945  $this,
946  $tb,
947  [
948  'auto_complete_name' => $this->lng->txt('user'),
949  'submit_name' => $this->lng->txt('add')
950  ]
951  );
952 
953  $tb->addSpacer();
954 
955  $tb->addComponent(
956  $this->ui_factory->link()->standard(
957  $this->lng->txt('search_user'),
958  $this->ctrl->getLinkTargetByClass('ilRepositorySearchGUI', 'start')
959  )
960  );
961  $tb->addSpacer();
962  }
963 
964  $tb->addComponent(
965  $this->ui_factory->link()->standard(
966  $this->lng->txt('role_mailto'),
967  $this->ctrl->getLinkTarget($this, 'mailToRole')
968  )
969  );
970  $this->tpl->setVariable('BUTTONS_UA', $tb->getHTML());
971 
972  $role_assignment_editable = true;
973  if (
974  $this->object->getId() == SYSTEM_ROLE_ID &&
975  !ilSecuritySettings::_getInstance()->checkAdminRoleAccessible($this->user->getId())) {
976  $role_assignment_editable = false;
977  }
978  $ut = new ilAssignedUsersTableGUI(
979  $this,
980  'userassignment',
981  $this->ui_factory,
982  $this->ui_renderer,
983  $this->object->getId(),
984  $role_assignment_editable,
985  $this->getAdminMode() === self::ADMIN_MODE_SETTINGS
986  );
987  $this->tpl->setVariable('TABLE_UA', $ut->getHTML());
988  }
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 47 of file class.ilObjRoleGUI.php.

Referenced by getContainerType().

◆ $help

ilHelpGUI ilObjRoleGUI::$help
protected

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

◆ $logger

ilLogger ilObjRoleGUI::$logger
private

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

◆ $obj_obj_id

int ilObjRoleGUI::$obj_obj_id = 0
protected

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

Referenced by getParentObjId().

◆ $obj_obj_type

string ilObjRoleGUI::$obj_obj_type = ''
protected

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

Referenced by getParentType().

◆ $obj_ref_id

◆ $refinery

Factory ilObjRoleGUI::$refinery
protected

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

◆ $role_id

int ilObjRoleGUI::$role_id = 0
protected

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

Referenced by getRoleId().

◆ $ui_factory

UIFactory ilObjRoleGUI::$ui_factory
protected

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

◆ $ui_renderer

Renderer ilObjRoleGUI::$ui_renderer
protected

Definition at line 53 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 41 of file class.ilObjRoleGUI.php.

◆ FORM_KEY_DESCRIPTION

const ilObjRoleGUI::FORM_KEY_DESCRIPTION = 'description'
private

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

◆ FORM_KEY_ILIAS_ID

const ilObjRoleGUI::FORM_KEY_ILIAS_ID = 'ilias_id'
private

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

◆ FORM_KEY_ON_REGISTRATION_FORM

const ilObjRoleGUI::FORM_KEY_ON_REGISTRATION_FORM = 'on_registration_form'
private

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

◆ FORM_KEY_PROTECT

const ilObjRoleGUI::FORM_KEY_PROTECT = 'protect'
private

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

◆ FORM_KEY_TITLE

const ilObjRoleGUI::FORM_KEY_TITLE = 'title'
private

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


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