ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilObjRoleGUI Class Reference

Class ilObjRoleGUI. More...

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

Public Member Functions

 __construct ( $a_data, int $a_id, bool $a_call_by_reference=false, bool $a_prepare_output=true)
 
 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 ()
 Only called from administration -> role folder ? Otherwise this check access is wrong. More...
 
 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...
 
 cancelObject ()
 cancelObject is called when an operation is canceled, method links back public More...
 
 mailToRoleObject ()
 
 checkAccess (string $a_perm_global, string $a_perm_obj='')
 
- Public Member Functions inherited from ilObjectGUI
 __construct ($data, int $id=0, bool $call_by_reference=true, bool $prepare_output=true)
 
 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] don't belong to the current 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...
 
 cancelDeleteObject ()
 cancel deletion of object More...
 
 cancelObject ()
 cancel action and go back to previous page More...
 
 createObject ()
 create new object form More...
 
 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)
 
 redirectAfterCreation ()
 Redirect after creation, see https://docu.ilias.de/goto_docu_wiki_wpage_5035_1357.html Should be overwritten and redirect to settings screen. More...
 
 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...
 
 initFormRoleProperties (int $a_mode)
 
 loadRoleProperties (ilObjRole $role, ilPropertyFormGUI $form)
 Store form input in role object. More...
 
 readRoleProperties (ilObject $role, ilPropertyFormGUI $form)
 Read role properties and write them to form. More...
 
 permObject (bool $a_show_admin_permissions=false)
 
 adminPermObject ()
 Show administration permissions. More...
 
 adminPermSaveObject ()
 Save admin permissions. More...
 
 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 ()
 
 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...
 
 initCreationForms (string $new_type)
 Init creation forms. More...
 
 getCreationFormsHTML (array $forms)
 Get HTML for creation forms (accordion) More...
 
 initCreateForm (string $new_type)
 
 initDidacticTemplate (ilPropertyFormGUI $form)
 
 addDidacticTemplateOptions (array &$a_options)
 Add custom templates. More...
 
 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...
 
 initImportForm (string $new_type)
 
 importFileObject (int $parent_id=null)
 
 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...
 
 fillCloneTemplate (?string $tpl_name, string $type)
 Fill object clone template This method can be called from any object GUI class that wants to offer object cloning. 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...
 
 showCustomIconsEditing ( $input_colspan=1, ilPropertyFormGUI $form=null, $as_section=true)
 show edit section of custom icons for container More...
 

Protected Attributes

const MODE_GLOBAL_UPDATE = 1
 
const MODE_GLOBAL_CREATE = 2
 
const MODE_LOCAL_UPDATE = 3
 
const MODE_LOCAL_CREATE = 4
 
int $obj_ref_id = 0
 
int $obj_obj_id = 0
 
string $obj_obj_type = ''
 
string $container_type = ''
 
int $role_id = 0
 
ilRbacAdmin $rbacadmin
 
ilHelpGUI $help
 
Factory $refinery
 
- 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
 
Factory $refinery
 
ilFavouritesManager $favourites
 
ilObjectCustomIconFactory $custom_icon_factory
 
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 Attributes

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 ALLOWED_TAGS_IN_TITLE_AND_DESCRIPTION
 
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
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilObjRoleGUI::__construct (   $a_data,
int  $a_id,
bool  $a_call_by_reference = false,
bool  $a_prepare_output = true 
)

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

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), ilObject\_lookupObjId(), ilObject\_lookupType(), ILIAS\Repository\ctrl(), getParentObjId(), getParentRefId(), ILIAS\Repository\help(), ILIAS\FileDelivery\http(), initParentRefId(), ILIAS\Repository\lng(), ILIAS\Repository\logger(), and ILIAS\Repository\refinery().

55  {
56  global $DIC;
57 
58  $this->rbacadmin = $DIC->rbac()->admin();
59  $this->help = $DIC->help();
60  $this->logger = $DIC->logger()->ac();
61 
62  $this->role_id = $a_id;
63  $this->http = $DIC->http();
64  $this->refinery = $DIC->refinery();
65 
66  // Add ref_id of object that contains role
67  $this->initParentRefId();
68  $this->obj_obj_id = ilObject::_lookupObjId($this->getParentRefId());
69  $this->obj_obj_type = ilObject::_lookupType($this->getParentObjId());
70  $this->container_type = ilObject::_lookupType(ilObject::_lookupObjId($this->obj_ref_id));
71 
72  $this->type = "role";
73  parent::__construct($a_data, $a_id, $a_call_by_reference, false);
74  $this->ctrl->saveParameter($this, ['obj_id', 'rolf_ref_id']);
75  $this->lng->loadLanguageModule('rbac');
76  }
static _lookupObjId(int $ref_id)
global $DIC
Definition: feed.php:28
static http()
Fetches the global http state from ILIAS.
getParentObjId()
Get obj_id of current object.
getParentRefId()
Get ref id of current object (not role folder id)
__construct(Container $dic, ilPlugin $plugin)
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:

Member Function Documentation

◆ addAdminLocatorItems()

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

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

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

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

◆ addLocatorItems()

ilObjRoleGUI::addLocatorItems ( )
protected

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

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

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

References $GLOBALS, ILIAS\Repository\ctrl(), ILIAS\Survey\Mode\getId(), ilUserClipboard\getInstance(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), and ILIAS\Repository\refinery().

1244  : void
1245  {
1246  $users = [];
1247  if ($this->http->wrapper()->post()->has('user_id')) {
1248  $users = $this->http->wrapper()->post()->retrieve(
1249  'user_id',
1250  $this->refinery->kindlyTo()->listOf(
1251  $this->refinery->kindlyTo()->int()
1252  )
1253  );
1254  }
1255  if (count($users) === 0) {
1256  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'), true);
1257  $this->ctrl->redirect($this, 'userassignment');
1258  }
1259  $clip = ilUserClipboard::getInstance($GLOBALS['DIC']['ilUser']->getId());
1260  $clip->add($users);
1261  $clip->save();
1262 
1263  $this->lng->loadLanguageModule('user');
1264  $this->tpl->setOnScreenMessage('success', $this->lng->txt('clipboard_user_added'), true);
1265  $this->ctrl->redirect($this, 'userassignment');
1266  }
static http()
Fetches the global http state from ILIAS.
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
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 792 of file class.ilObjRoleGUI.php.

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

792  : void
793  {
794  if (!$this->checkAccess('edit_userassignment', 'edit_permission')) {
795  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('msg_no_perm_assign_user_to_role'), true);
796  return;
797  }
798  if (!$this->rbac_review->isAssignable($this->object->getId(), $this->obj_ref_id) &&
799  $this->obj_ref_id != ROLE_FOLDER_ID) {
800  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('err_role_not_assignable'), true);
801  return;
802  }
803  if ($a_user_ids === []) {
804  $GLOBALS['DIC']['lng']->loadLanguageModule('search');
805  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('search_err_user_not_exist'), true);
806  return;
807  }
808 
809  $assigned_users_all = $this->rbac_review->assignedUsers($this->object->getId());
810 
811  // users to assign
812  $assigned_users_new = array_diff($a_user_ids, array_intersect($a_user_ids, $assigned_users_all));
813 
814  // selected users all already assigned. stop
815  if (count($assigned_users_new) == 0) {
816  $this->tpl->setOnScreenMessage('info', $this->lng->txt("rbac_msg_user_already_assigned"), true);
817  $this->ctrl->redirect($this, 'userassignment');
818  }
819 
820  // assign new users
821  foreach ($assigned_users_new as $user_id) {
822  if ($user_id === ANONYMOUS_USER_ID) {
823  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('msg_anonymous_cannot_be_assigned'), true);
824  return;
825  }
826  $this->rbacadmin->assignUser($this->object->getId(), $user_id, false);
827  }
828 
829  // update object data entry (to update last modification date)
830  $this->object->update();
831 
832  $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_userassignment_changed"), true);
833  $this->ctrl->redirect($this, 'userassignment');
834  }
const ANONYMOUS_USER_ID
Definition: constants.php:27
checkAccess(string $a_perm_global, string $a_perm_obj='')
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
const ROLE_FOLDER_ID
Definition: constants.php:34
+ Here is the call graph for this function:

◆ adminPermObject()

ilObjRoleGUI::adminPermObject ( )
protected

Show administration permissions.

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

References permObject().

516  : void
517  {
518  $this->permObject(true);
519  }
permObject(bool $a_show_admin_permissions=false)
+ Here is the call graph for this function:

◆ adminPermSaveObject()

ilObjRoleGUI::adminPermSaveObject ( )
protected

Save admin permissions.

Returns

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

References permSaveObject().

525  : void
526  {
527  $this->permSaveObject(true);
528  }
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 530 of file class.ilObjRoleGUI.php.

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

Referenced by adoptPermSaveObject().

530  : void
531  {
532  $output = [];
533  $parent_role_ids = $this->rbac_review->getParentRoleIds($this->obj_ref_id, true);
534 
535  $this->tabs_gui->clearTargets();
536 
537  $ids = [];
538  foreach (array_keys($parent_role_ids) as $id) {
539  $ids[] = $id;
540  }
541  // Sort ids
542  $sorted_ids = ilUtil::_sortIds($ids, 'object_data', 'type,title', 'obj_id');
543  $key = 0;
544  foreach ($sorted_ids as $id) {
545  $par = $parent_role_ids[$id];
546  if ($par["obj_id"] != SYSTEM_ROLE_ID && $this->object->getId() != $par["obj_id"]) {
547  $output[$key]["role_id"] = $par["obj_id"];
548  $output[$key]["type"] = ($par["type"] == 'role' ? $this->lng->txt('obj_role') : $this->lng->txt('obj_rolt'));
549  $output[$key]["role_name"] = ilObjRole::_getTranslation($par["title"]);
550  $output[$key]["role_desc"] = $par["desc"];
551  $key++;
552  }
553  }
554 
555  $tbl = new ilRoleAdoptPermissionTableGUI($this, "adoptPerm");
556  $tbl->setTitle($this->lng->txt("adopt_perm_from_template"));
557  $tbl->setData($output);
558 
559  $this->tpl->setContent($tbl->getHTML());
560  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const SYSTEM_ROLE_ID
Definition: constants.php:29
static _getTranslation(string $a_role_title)
string $key
Consumer key/client ID value.
Definition: System.php:193
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 743 of file class.ilObjRoleGUI.php.

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

743  : void
744  {
745  $source = 0;
746  if ($this->http->wrapper()->post()->has('adopt')) {
747  $source = $this->http->wrapper()->post()->retrieve(
748  'adopt',
749  $this->refinery->kindlyTo()->int()
750  );
751  }
752 
753  if (!$source) {
754  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'));
755  $this->adoptPermObject();
756  return;
757  }
758 
759  $access = $this->checkAccess('visible,write', 'edit_permission');
760  if (!$access) {
761  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('msg_no_perm_perm'), true);
762  }
763  if ($this->object->getId() == $source) {
764  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("msg_perm_adopted_from_itself"), true);
765  } else {
766  $this->rbacadmin->deleteRolePermission($this->object->getId(), $this->obj_ref_id);
767  $parentRoles = $this->rbac_review->getParentRoleIds($this->obj_ref_id, true);
768  $this->rbacadmin->copyRoleTemplatePermissions(
769  $source,
770  $parentRoles[$source]["parent"],
771  $this->obj_ref_id,
772  $this->object->getId(),
773  false
774  );
775 
776  // update object data entry (to update last modification date)
777  $this->object->update();
778 
779  // send info
780  $title = ilObject::_lookupTitle($source);
781  $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_perm_adopted_from1") . " '" .
782  ilObjRole::_getTranslation($title) . "'.<br/>" .
783  $this->lng->txt("msg_perm_adopted_from2"), true);
784  }
785 
786  $this->ctrl->redirect($this, "perm");
787  }
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
$source
Definition: metadata.php:93
+ Here is the call graph for this function:

◆ cancelObject()

ilObjRoleGUI::cancelObject ( )

cancelObject is called when an operation is canceled, method links back public

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

References ILIAS\Repository\ctrl().

987  : void
988  {
989  if ($this->requested_new_type != 'role') {
990  $this->ctrl->redirect($this, 'userassignment');
991  } else {
992  $this->ctrl->redirectByClass("ilobjrolefoldergui", "view");
993  }
994  }
+ Here is the call graph for this function:

◆ changeExistingObjectsObject()

ilObjRoleGUI::changeExistingObjectsObject ( )
protected

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

1195  : void
1196  {
1197  $mode = 0;
1198  if ($this->http->wrapper()->post()->has('mode')) {
1199  $mode = $this->http->wrapper()->post()->retrieve(
1200  'mode',
1201  $this->refinery->kindlyTo()->int()
1202  );
1203  }
1204  $start = ($this->obj_ref_id == ROLE_FOLDER_ID ? ROOT_FOLDER_ID : $this->obj_ref_id);
1205 
1206  $type_filter = [];
1207  if ($this->http->wrapper()->post()->has('type_filter')) {
1208  $serialized_type_filter = $this->http->wrapper()->post()->retrieve(
1209  'type_filter',
1210  $this->refinery->kindlyTo()->string()
1211  );
1212  $type_filter = json_decode(
1213  $serialized_type_filter,
1214  true
1215  );
1216  }
1217 
1218  $this->object->changeExistingObjects($start, $mode, $type_filter);
1219  $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
1220  $this->ctrl->redirect($this, 'perm');
1221  }
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 1105 of file class.ilObjRoleGUI.php.

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

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

1105  : bool
1106  {
1107  $a_perm_obj = $a_perm_obj ?: $a_perm_global;
1108 
1109  if ($this->obj_ref_id == ROLE_FOLDER_ID) {
1110  return $this->rbac_system->checkAccess($a_perm_global, $this->obj_ref_id);
1111  } else {
1112  return $this->access->checkAccess($a_perm_obj, '', $this->obj_ref_id);
1113  }
1114  }
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 565 of file class.ilObjRoleGUI.php.

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

565  : void
566  {
567  $this->tabs_gui->clearTargets();
568 
569  if (!$this->checkAccess('visible,write', 'edit_permission')) {
570  $this->tpl->setOnScreenMessage('msg_no_perm_perm', $this->lng->txt('permission_denied'), true);
571  $this->ctrl->redirectByClass(ilRepositoryGUI::class);
572  }
573 
574  $question = $this->lng->txt('rbac_role_delete_qst');
575  if ($this->rbac_review->isAssigned($this->user->getId(), $this->object->getId())) {
576  $question .= ('<br />' . $this->lng->txt('rbac_role_delete_self'));
577  }
578  $this->tpl->setOnScreenMessage('question', $question);
579 
580  $confirm = new ilConfirmationGUI();
581  $confirm->setFormAction($this->ctrl->getFormAction($this));
582  $confirm->setHeaderText($question);
583  $confirm->setCancel($this->lng->txt('cancel'), 'perm');
584  $confirm->setConfirm($this->lng->txt('rbac_delete_role'), 'performDeleteRole');
585 
586  $confirm->addItem(
587  'role',
588  (string) $this->object->getId(),
589  ilObjRole::_getTranslation($this->object->getTitle()),
590  ilUtil::getImagePath('icon_role.svg')
591  );
592 
593  $this->tpl->setContent($confirm->getHTML());
594  }
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
checkAccess(string $a_perm_global, string $a_perm_obj='')
static _getTranslation(string $a_role_title)
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:

◆ createObject()

ilObjRoleGUI::createObject ( )

Only called from administration -> role folder ? Otherwise this check access is wrong.

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

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

339  : void
340  {
341  if (!$this->rbac_system->checkAccess('create_role', $this->obj_ref_id)) {
342  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('permission_denied'), true);
343  $this->ctrl->redirectByClass(ilRepositoryGUI::class);
344  }
345  $form = $this->initFormRoleProperties(self::MODE_GLOBAL_CREATE);
346  $this->tpl->setContent($form->getHTML());
347  }
initFormRoleProperties(int $a_mode)
+ Here is the call graph for this function:

◆ deassignUserObject()

ilObjRoleGUI::deassignUserObject ( )

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

836  : void
837  {
838  if (!$this->checkAccess('edit_userassignment', 'edit_permission')) {
839  $this->ilias->raiseError(
840  $this->lng->txt("msg_no_perm_assign_user_to_role"),
841  $this->ilias->error_obj->MESSAGE
842  );
843  }
844 
845  $selected_users = [];
846  if ($this->http->wrapper()->query()->has('user_id')) {
847  $selected_users = [
848  $this->http->wrapper()->query()->retrieve(
849  'user_id',
850  $this->refinery->kindlyTo()->int()
851  )
852  ];
853  }
854  if ($this->http->wrapper()->post()->has('user_id')) {
855  $selected_users = $this->http->wrapper()->post()->retrieve(
856  'user_id',
857  $this->refinery->kindlyTo()->listOf(
858  $this->refinery->kindlyTo()->int()
859  )
860  );
861  }
862  if (count($selected_users) === 0) {
863  $this->ilias->raiseError($this->lng->txt("no_checkbox"), $this->ilias->error_obj->MESSAGE);
864  }
865 
866  // prevent unassignment of system user from system role
867  if ($this->object->getId() == SYSTEM_ROLE_ID) {
868  if ($admin = array_search(SYSTEM_USER_ID, $selected_users) !== false) {
869  unset($selected_users[$admin]);
870  }
871  }
872 
873  // check for each user if the current role is his last global role before deassigning him
874  $last_role = [];
875  $global_roles = $this->rbac_review->getGlobalRoles();
876  foreach ($selected_users as $user) {
877  $assigned_roles = $this->rbac_review->assignedRoles($user);
878  $assigned_global_roles = array_intersect($assigned_roles, $global_roles);
879 
880  if (count($assigned_roles) == 1 || count($assigned_global_roles) == 1 && in_array(
881  $this->object->getId(),
882  $assigned_global_roles
883  )) {
884  $userObj = new ilObjUser($user);
885  $last_role[$user] = $userObj->getFullName();
886  unset($userObj);
887  }
888  }
889 
890  // ... else perform deassignment
891  foreach ($selected_users as $user) {
892  if (!isset($last_role[$user])) {
893  $this->rbacadmin->deassignUser($this->object->getId(), $user);
894  }
895  }
896 
897  // update object data entry (to update last modification date)
898  $this->object->update();
899 
900  // raise error if last role was taken from a user...
901  if ($last_role !== []) {
902  $user_list = implode(", ", $last_role);
903  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('msg_is_last_role') . ': ' . $user_list . '<br />' . $this->lng->txt('msg_min_one_role'), true);
904  } else {
905  $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_userassignment_changed"), true);
906  }
907  $this->ctrl->redirect($this, 'userassignment');
908  }
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.
header include for all ilias files.
+ Here is the call graph for this function:

◆ editObject()

ilObjRoleGUI::editObject ( )

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

References $obj_ref_id, checkAccess(), ILIAS\Repository\ctrl(), initFormRoleProperties(), ILIAS\Repository\lng(), ILIAS\Repository\object(), readRoleProperties(), SYSTEM_ROLE_ID, and ILIAS\Repository\toolbar().

349  : void
350  {
351  if (!$this->checkAccess('write', 'edit_permission')) {
352  $this->tpl->setOnScreenMessage('msg_no_perm_write', $this->lng->txt('permission_denied'), true);
353  $this->ctrl->redirectByClass(ilRepositoryGUI::class);
354  }
355  $this->tabs_gui->activateTab('edit_properties');
356 
357  // Show copy role button
358  if ($this->object->getId() != SYSTEM_ROLE_ID) {
359  $this->toolbar->setFormAction($this->ctrl->getFormAction($this));
360  if ($this->rbac_review->isDeleteable($this->object->getId(), $this->obj_ref_id)) {
361  $this->toolbar->addButton(
362  $this->lng->txt('rbac_delete_role'),
363  $this->ctrl->getLinkTarget($this, 'confirmDeleteRole')
364  );
365  }
366  }
367  $form = $this->initFormRoleProperties(self::MODE_GLOBAL_UPDATE);
368  $this->readRoleProperties($this->object, $form);
369  $this->tpl->setContent($form->getHTML());
370  }
readRoleProperties(ilObject $role, ilPropertyFormGUI $form)
Read role properties and write them to form.
const SYSTEM_ROLE_ID
Definition: constants.php:29
checkAccess(string $a_perm_global, string $a_perm_obj='')
initFormRoleProperties(int $a_mode)
+ Here is the call graph for this function:

◆ ensureRoleAccessForContext()

ilObjRoleGUI::ensureRoleAccessForContext ( )
protected

Ensure access to role for ref_id.

Exceptions
ilObjectException

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

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

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

78  : void
79  {
80  $this->prepareOutput();
81 
82  $next_class = $this->ctrl->getNextClass($this);
83  $cmd = $this->ctrl->getCmd();
84 
86 
87  switch ($next_class) {
88  case 'ilrepositorysearchgui':
89 
90  if (!$GLOBALS['DIC']['ilAccess']->checkAccess('edit_permission', '', $this->obj_ref_id)) {
91  $GLOBALS['DIC']['ilErr']->raiseError(
92  $GLOBALS['DIC']['lng']->txt('permission_denied'),
93  $GLOBALS['DIC']['ilErr']->WARNING
94  );
95  }
96  $rep_search = new ilRepositorySearchGUI();
97  $rep_search->setTitle($this->lng->txt('role_add_user'));
98  $rep_search->setCallback($this, 'addUserObject');
99 
100  // Set tabs
101  $this->tabs_gui->setTabActive('user_assignment');
102  $this->ctrl->setReturn($this, 'userassignment');
103  $ret = $this->ctrl->forwardCommand($rep_search);
104  break;
105 
106  case 'ilexportgui':
107 
108  $this->tabs_gui->setTabActive('export');
109 
111  $eo->addOption(ilExportOptions::KEY_ROOT, 0, $this->object->getId(), $this->obj_ref_id);
112 
113  $exp = new ilExportGUI($this, new ilObjRole($this->object->getId()));
114  $exp->addFormat('xml');
115  $this->ctrl->forwardCommand($exp);
116  break;
117 
118  case 'ilrecommendedcontentroleconfiggui':
119  $this->tabs_gui->setTabActive('rep_recommended_content');
120  $ui = new ilRecommendedContentRoleConfigGUI($this->object->getId(), $this->obj_ref_id);
121  $this->ctrl->forwardCommand($ui);
122  break;
123 
124  default:
125  if (!$cmd) {
126  if ($this->showDefaultPermissionSettings()) {
127  $cmd = "perm";
128  } else {
129  $cmd = 'userassignment';
130  }
131  }
132  $cmd .= "Object";
133  $this->$cmd();
134 
135  break;
136  }
137  }
Class ilObjRole.
prepareOutput(bool $show_sub_objects=true)
static newInstance(int $a_export_id)
checkAccess(string $a_perm_global, string $a_perm_obj='')
ensureRoleAccessForContext()
Ensure access to role for ref_id.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
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 205 of file class.ilObjRoleGUI.php.

References getTabs().

205  : void
206  {
207  $this->getTabs();
208  }
+ Here is the call graph for this function:

◆ getContainerType()

ilObjRoleGUI::getContainerType ( )
protected

Get type of role container.

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

References $container_type.

Referenced by showDefaultPermissionSettings().

213  : string
214  {
215  return $this->container_type;
216  }
+ Here is the caller graph for this function:

◆ getParentObjId()

ilObjRoleGUI::getParentObjId ( )

Get obj_id of current object.

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

References $obj_obj_id.

Referenced by __construct().

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

◆ getParentRefId()

ilObjRoleGUI::getParentRefId ( )

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

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

References $obj_ref_id.

Referenced by __construct(), and permObject().

181  : int
182  {
183  return $this->obj_ref_id;
184  }
+ Here is the caller graph for this function:

◆ getParentType()

ilObjRoleGUI::getParentType ( )

get type of current object (not role folder)

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

References $obj_obj_type.

Referenced by permObject(), and permSaveObject().

197  : string
198  {
199  return $this->obj_obj_type;
200  }
+ Here is the caller graph for this function:

◆ getRoleId()

ilObjRoleGUI::getRoleId ( )
protected

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

References $role_id.

Referenced by addAdminLocatorItems(), and addLocatorItems().

139  : int
140  {
141  return $this->role_id;
142  }
+ Here is the caller graph for this function:

◆ getTabs()

ilObjRoleGUI::getTabs ( )
protected

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

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

◆ initFormRoleProperties()

ilObjRoleGUI::initFormRoleProperties ( int  $a_mode)
protected

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

References ILIAS\Repository\ctrl(), ilObjRole\isAutoGenerated(), ILIAS\Repository\lng(), ILIAS\Repository\object(), ROLE_FOLDER_ID, ilFormPropertyGUI\setDisabled(), and ilCheckboxInputGUI\setValue().

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

228  {
229  $form = new ilPropertyFormGUI();
230 
231  if ($this->creation_mode) {
232  $this->ctrl->setParameter($this, "new_type", 'role');
233  }
234  $form->setFormAction($this->ctrl->getFormAction($this));
235 
236  switch ($a_mode) {
237  case self::MODE_GLOBAL_CREATE:
238  $form->setTitle($this->lng->txt('role_new'));
239  $form->addCommandButton('save', $this->lng->txt('role_new'));
240  break;
241 
242  case self::MODE_GLOBAL_UPDATE:
243  $form->setTitle($this->lng->txt('role_edit'));
244  $form->addCommandButton('update', $this->lng->txt('save'));
245  break;
246 
247  case self::MODE_LOCAL_CREATE:
248  case self::MODE_LOCAL_UPDATE:
249  }
250  // Fix cancel
251  $form->addCommandButton('cancel', $this->lng->txt('cancel'));
252 
253  $title = new ilTextInputGUI($this->lng->txt('title'), 'title');
254  if (ilObjRole::isAutoGenerated($this->object->getId())) {
255  $title->setDisabled(true);
256  } else {
257  //#17111 No validation for disabled fields
258  $title->setValidationRegexp('/^(?!il_).*$/');
259  $title->setValidationFailureMessage($this->lng->txt('msg_role_reserved_prefix'));
260  }
261 
262  $title->setSize(40);
263  $title->setMaxLength(70);
264  $title->setRequired(true);
265  $form->addItem($title);
266 
267  $desc = new ilTextAreaInputGUI($this->lng->txt('description'), 'desc');
268  if (ilObjRole::isAutoGenerated($this->object->getId())) {
269  $desc->setDisabled(true);
270  }
271  $desc->setCols(40);
272  $desc->setRows(3);
273  $form->addItem($desc);
274 
275  if ($a_mode != self::MODE_LOCAL_CREATE && $a_mode != self::MODE_GLOBAL_CREATE) {
276  $ilias_id = new ilNonEditableValueGUI($this->lng->txt("ilias_id"), "ilias_id");
277  $form->addItem($ilias_id);
278  }
279 
280  if ($this->obj_ref_id == ROLE_FOLDER_ID) {
281  $reg = new ilCheckboxInputGUI($this->lng->txt('allow_register'), 'reg');
282  $reg->setValue("1");
283  #$reg->setInfo($this->lng->txt('rbac_new_acc_reg_info'));
284  $form->addItem($reg);
285 
286  $la = new ilCheckboxInputGUI($this->lng->txt('allow_assign_users'), 'la');
287  $la->setValue("1");
288  #$la->setInfo($this->lng->txt('rbac_local_admin_info'));
289  $form->addItem($la);
290  }
291 
292  $pro = new ilCheckboxInputGUI($this->lng->txt('role_protect_permissions'), 'pro');
293  $pro->setValue("1");
294  #$pro->setInfo($this->lng->txt('role_protext_permission_info'));
295  $form->addItem($pro);
296  return $form;
297  }
static isAutoGenerated(int $a_role_id)
This class represents a checkbox property in a property form.
const ROLE_FOLDER_ID
Definition: constants.php:34
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a text area property in a property form.
setDisabled(bool $a_disabled)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initParentRefId()

ilObjRoleGUI::initParentRefId ( )
protected

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

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

Referenced by __construct().

144  : void
145  {
146  $this->obj_ref_id = 0;
147 
148  if ($this->http->wrapper()->query()->has('rolf_ref_id')) {
149  $this->obj_ref_id = $this->http->wrapper()->query()->retrieve(
150  'rolf_ref_id',
151  $this->refinery->kindlyTo()->int()
152  );
153  } elseif ($this->http->wrapper()->query()->has('ref_id')) {
154  $this->obj_ref_id = $this->http->wrapper()->query()->retrieve(
155  'ref_id',
156  $this->refinery->kindlyTo()->int()
157  );
158  }
159  }
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:

◆ isChangeExistingObjectsConfirmationRequired()

ilObjRoleGUI::isChangeExistingObjectsConfirmationRequired ( )
protected

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

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

Referenced by permSaveObject().

1119  : bool
1120  {
1121  // Role is protected
1122  if ($this->rbac_review->isProtected($this->obj_ref_id, $this->object->getId())) {
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  } else {
1127  // TODO: check if recursive_list is enabled
1128  // and if yes: check if inheritance is broken for the relevant object types
1129  return count($this->rbac_review->getFoldersAssignedToRole($this->object->getId())) > 1;
1130  }
1131  }
+ Here is the caller graph for this function:

◆ loadRoleProperties()

ilObjRoleGUI::loadRoleProperties ( ilObjRole  $role,
ilPropertyFormGUI  $form 
)
protected

Store form input in role object.

Parameters
object$role

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

References ilPropertyFormGUI\getInput(), ilPropertyFormGUI\getItemByPostVar(), ilObjRole\setAllowRegister(), ilObject\setDescription(), ilObject\setTitle(), and ilObjRole\toggleAssignUsersStatus().

Referenced by saveObject(), and updateObject().

303  : void
304  {
305  //Don't set if fields are disabled to prevent html manipulation.
306  if (!$form->getItemByPostVar('title')->getDisabled()) {
307  $role->setTitle((string) $form->getInput('title'));
308  }
309  if (!$form->getItemByPostVar('desc')->getDisabled()) {
310  $role->setDescription((string) $form->getInput('desc'));
311  }
312  $role->setAllowRegister((bool) $form->getInput('reg'));
313  $role->toggleAssignUsersStatus((bool) $form->getInput('la'));
314  }
getItemByPostVar(string $a_post_var)
setAllowRegister(bool $a_allow_register)
setTitle(string $title)
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...
toggleAssignUsersStatus(bool $a_assign_users)
setDescription(string $desc)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mailToRoleObject()

ilObjRoleGUI::mailToRoleObject ( )

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

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

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

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

599  : void
600  {
601  if (!$this->checkAccess('visible,write', 'edit_permission')) {
602  $this->tpl->setOnScreenMessage('msg_no_perm_perm', $this->lng->txt('permission_denied'), true);
603  $this->ctrl->redirectByClass(ilRepositoryGUI::class);
604  }
605 
606  $this->object->setParent($this->obj_ref_id);
607  $this->object->delete();
608  $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_deleted_role'), true);
609 
610  $this->ctrl->returnToParent($this);
611  }
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 423 of file class.ilObjRoleGUI.php.

References $obj_ref_id, ilTable2GUI\addMultiCommand(), 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().

423  : void
424  {
425  $this->tabs_gui->setTabActive('default_perm_settings');
426 
427  $this->setSubTabs('default_perm_settings');
428 
429  if ($a_show_admin_permissions) {
430  $this->tabs_gui->setSubTabActive('rbac_admin_permissions');
431  } else {
432  $this->tabs_gui->setSubTabActive('rbac_repository_permissions');
433  }
434 
435  if (!$this->checkAccess('write', 'edit_permission')) {
436  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('msg_no_perm_write'), true);
437  $this->ctrl->redirectByClass(ilRepositoryGUI::class);
438  }
439 
440  // Show copy role button
441  if ($this->object->getId() != SYSTEM_ROLE_ID) {
442  $this->toolbar->setFormAction($this->ctrl->getFormAction($this));
443  $this->toolbar->addButton(
444  $this->lng->txt("adopt_perm_from_template"),
445  $this->ctrl->getLinkTarget($this, 'adoptPerm')
446  );
447  if ($this->rbac_review->isDeleteable($this->object->getId(), $this->obj_ref_id)) {
448  $this->toolbar->addButton(
449  $this->lng->txt('rbac_delete_role'),
450  $this->ctrl->getLinkTarget($this, 'confirmDeleteRole')
451  );
452  }
453  }
454 
455  $this->tpl->addBlockFile(
456  'ADM_CONTENT',
457  'adm_content',
458  'tpl.rbac_template_permissions.html',
459  'Services/AccessControl'
460  );
461 
462  $this->tpl->setVariable('PERM_ACTION', $this->ctrl->getFormAction($this));
463 
464  $acc = new ilAccordionGUI();
465  $acc->setBehaviour(ilAccordionGUI::FORCE_ALL_OPEN);
466  $acc->setId('template_perm_' . $this->getParentRefId());
467 
468  if ($this->obj_ref_id == ROLE_FOLDER_ID) {
469  if ($a_show_admin_permissions) {
470  $subs = ilObjRole::getSubObjects('adm', true);
471  } else {
472  $subs = ilObjRole::getSubObjects('root', false);
473  }
474  } else {
475  $subs = ilObjRole::getSubObjects($this->getParentType(), $a_show_admin_permissions);
476  }
477 
478  foreach ($subs as $subtype => $def) {
480  $this,
481  'perm',
482  $this->getParentRefId(),
483  $this->object->getId(),
484  $subtype,
485  $a_show_admin_permissions
486  );
487  $tbl->parse();
488 
489  $acc->addItem($def['translation'], $tbl->getHTML());
490  }
491 
492  $this->tpl->setVariable('ACCORDION', $acc->getHTML());
493 
494  // Add options table
496  $this,
497  'perm',
498  $this->obj_ref_id,
499  $this->object->getId(),
500  $a_show_admin_permissions
501  );
502  if ($this->object->getId() != SYSTEM_ROLE_ID) {
503  $options->addMultiCommand(
504  $a_show_admin_permissions ? 'adminPermSave' : 'permSave',
505  $this->lng->txt('save')
506  );
507  }
508 
509  $options->parse();
510  $this->tpl->setVariable('OPTIONS_TABLE', $options->getHTML());
511  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const SYSTEM_ROLE_ID
Definition: constants.php:29
checkAccess(string $a_perm_global, string $a_perm_obj='')
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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 617 of file class.ilObjRoleGUI.php.

References ILIAS\LTI\ToolProvider\$key, $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().

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

◆ readRoleProperties()

ilObjRoleGUI::readRoleProperties ( ilObject  $role,
ilPropertyFormGUI  $form 
)
protected

Read role properties and write them to form.

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

References ilObjectGUI\$data, $DIC, ilObject\_lookupType(), ilObject\getDescription(), ilObject\getId(), ilObject\getPresentationTitle(), IL_INST_ID, and ilPropertyFormGUI\setValuesByArray().

Referenced by editObject().

319  : void
320  {
321  global $DIC;
322 
323  $rbacreview = $DIC['rbacreview'];
324 
325  $data['title'] = $role->getPresentationTitle();
326  $data['desc'] = $role->getDescription();
327  $data['ilias_id'] = 'il_' . IL_INST_ID . '_' . ilObject::_lookupType($role->getId()) . '_' . $role->getId();
328  $data['reg'] = $role->getAllowRegister();
329  $data['la'] = $role->getAssignUsersStatus();
330  $data['pro'] = $rbacreview->isProtected($this->obj_ref_id, $role->getId());
331 
332  $form->setValuesByArray($data);
333  }
const IL_INST_ID
Definition: constants.php:40
global $DIC
Definition: feed.php:28
setValuesByArray(array $a_values, bool $a_restrict_to_value_keys=false)
static _lookupType(int $id, bool $reference=false)
getPresentationTitle()
get presentation title Normally same as title Overwritten for sessions
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ retrieveTemplatePermissionsFromPost()

ilObjRoleGUI::retrieveTemplatePermissionsFromPost ( )
protected

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

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

Referenced by permSaveObject().

161  : array
162  {
163  $template_permissions = [];
164  if ($this->http->wrapper()->post()->has('template_perm')) {
165  $custom_transformer = $this->refinery->custom()->transformation(
166  function ($array) {
167  return $array;
168  }
169  );
170  $template_permissions = $this->http->wrapper()->post()->retrieve(
171  'template_perm',
172  $custom_transformer
173  );
174  }
175  return $template_permissions;
176  }
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 376 of file class.ilObjRoleGUI.php.

References $obj_ref_id, ILIAS\Repository\ctrl(), initFormRoleProperties(), ILIAS\Repository\lng(), and loadRoleProperties().

376  : void
377  {
378  $form = $this->initFormRoleProperties(self::MODE_GLOBAL_CREATE);
379  if ($form->checkInput()) {
380  $role = new ilObjRole();
381  $this->loadRoleProperties($role, $form);
382  $role->create();
383  $this->rbacadmin->assignRoleToFolder($role->getId(), $this->obj_ref_id, 'y');
384  $this->rbacadmin->setProtected(
385  $this->obj_ref_id,
386  $role->getId(),
387  $form->getInput('pro') ? 'y' : 'n'
388  );
389  $this->tpl->setOnScreenMessage('success', $this->lng->txt("role_added"), true);
390  $this->ctrl->setParameter($this, 'obj_id', $role->getId());
391  $this->ctrl->redirect($this, 'perm');
392  }
393 
394  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('err_check_input'));
395  $form->setValuesByPost();
396  $this->tpl->setContent($form->getHTML());
397  }
Class ilObjRole.
loadRoleProperties(ilObjRole $role, ilPropertyFormGUI $form)
Store form input in role object.
initFormRoleProperties(int $a_mode)
+ Here is the call graph for this function:

◆ setSubTabs()

ilObjRoleGUI::setSubTabs (   $a_tab)
protected

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

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

Referenced by permObject().

1223  : void
1224  {
1225  switch ($a_tab) {
1226  case 'default_perm_settings':
1227  if ($this->obj_ref_id != ROLE_FOLDER_ID) {
1228  return;
1229  }
1230  $this->tabs_gui->addSubTabTarget(
1231  'rbac_repository_permissions',
1232  $this->ctrl->getLinkTarget($this, 'perm')
1233  );
1234  $this->tabs_gui->addSubTabTarget(
1235  'rbac_admin_permissions',
1236  $this->ctrl->getLinkTarget($this, 'adminPerm')
1237  );
1238  }
1239  }
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 1137 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().

1137  : void
1138  {
1139  $protected = false;
1140  if ($this->http->wrapper()->post()->has('protected')) {
1141  $protected = $this->http->wrapper()->post()->retrieve(
1142  'protected',
1143  $this->refinery->kindlyTo()->bool()
1144  );
1145  }
1146  $form = new ilPropertyFormGUI();
1147  $form->setFormAction($this->ctrl->getFormAction($this, 'changeExistingObjects'));
1148  $form->setTitle($this->lng->txt('rbac_change_existing_confirm_tbl'));
1149 
1150  $form->addCommandButton('changeExistingObjects', $this->lng->txt('change_existing_objects'));
1151  $form->addCommandButton('perm', $this->lng->txt('cancel'));
1152 
1153  $hidden = new ilHiddenInputGUI('type_filter');
1154  $hidden->setValue($recursive ? json_encode(['all']) : json_encode($recursive_list));
1155  $form->addItem($hidden);
1156 
1157  $rad = new ilRadioGroupInputGUI($this->lng->txt('rbac_local_policies'), 'mode');
1158 
1159  if ($protected) {
1161  $keep = new ilRadioOption(
1162  $this->lng->txt('rbac_keep_local_policies'),
1164  $this->lng->txt('rbac_keep_local_policies_info')
1165  );
1166  } else {
1168  $keep = new ilRadioOption(
1169  $this->lng->txt('rbac_keep_local_policies'),
1170  (string) ilObjRole::MODE_UNPROTECTED_KEEP_LOCAL_POLICIES,
1171  $this->lng->txt('rbac_unprotected_keep_local_policies_info')
1172  );
1173  }
1174  $rad->addOption($keep);
1175 
1176  if ($protected) {
1177  $del = new ilRadioOption(
1178  $this->lng->txt('rbac_delete_local_policies'),
1179  (string) ilObjRole::MODE_PROTECTED_DELETE_LOCAL_POLICIES,
1180  $this->lng->txt('rbac_delete_local_policies_info')
1181  );
1182  } else {
1183  $del = new ilRadioOption(
1184  $this->lng->txt('rbac_delete_local_policies'),
1186  $this->lng->txt('rbac_unprotected_delete_local_policies_info')
1187  );
1188  }
1189  $rad->addOption($del);
1190 
1191  $form->addItem($rad);
1192  $this->tpl->setContent($form->getHTML());
1193  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const MODE_PROTECTED_DELETE_LOCAL_POLICIES
const MODE_PROTECTED_KEEP_LOCAL_POLICIES
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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 221 of file class.ilObjRoleGUI.php.

References getContainerType().

Referenced by executeCommand(), and getTabs().

221  : bool
222  {
223  return $this->obj_definition->isContainer($this->getContainerType())
224  || $this->obj_definition->isAdministrationObject($this->getContainerType());
225  }
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 403 of file class.ilObjRoleGUI.php.

References ILIAS\Repository\ctrl(), initFormRoleProperties(), ILIAS\Repository\lng(), loadRoleProperties(), and ILIAS\Repository\object().

403  : void
404  {
405  $form = $this->initFormRoleProperties(self::MODE_GLOBAL_UPDATE);
406  if ($form->checkInput()) {
407  $this->loadRoleProperties($this->object, $form);
408  $this->object->update();
409  $this->rbacadmin->setProtected(
410  $this->obj_ref_id,
411  $this->object->getId(),
412  $form->getInput('pro') ? 'y' : 'n'
413  );
414  $this->tpl->setOnScreenMessage('success', $this->lng->txt("saved_successfully"), true);
415  $this->ctrl->redirect($this, 'edit');
416  }
417 
418  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('err_check_input'));
419  $form->setValuesByPost();
420  $this->tpl->setContent($form->getHTML());
421  }
loadRoleProperties(ilObjRole $role, ilPropertyFormGUI $form)
Store form input in role object.
initFormRoleProperties(int $a_mode)
+ Here is the call graph for this function:

◆ userassignmentObject()

ilObjRoleGUI::userassignmentObject ( )

display user assignment panel

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

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

913  : void
914  {
915  global $DIC;
916 
917  $ilUser = $DIC['ilUser'];
918 
919  if (!$this->checkAccess('edit_userassignment', 'edit_permission')) {
920  $this->ilias->raiseError(
921  $this->lng->txt("msg_no_perm_assign_user_to_role"),
922  $this->ilias->error_obj->MESSAGE
923  );
924  }
925 
926  $this->tabs_gui->setTabActive('user_assignment');
927 
928  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.rbac_ua.html', 'Services/AccessControl');
929 
930  $tb = new ilToolbarGUI();
931 
932  // protected admin role
933  if (
934  $this->object->getId() != SYSTEM_ROLE_ID ||
935  (
936  $this->rbac_review->isAssigned($ilUser->getId(), SYSTEM_ROLE_ID) ||
937  !ilSecuritySettings::_getInstance()->isAdminRoleProtected()
938  )
939  ) {
940 
941 
942  // add member
944  $this,
945  $tb,
946  [
947  'auto_complete_name' => $this->lng->txt('user'),
948  'submit_name' => $this->lng->txt('add')
949  ]
950  );
951 
952  $tb->addSpacer();
953 
954  $tb->addButton(
955  $this->lng->txt('search_user'),
956  $this->ctrl->getLinkTargetByClass('ilRepositorySearchGUI', 'start')
957  );
958  $tb->addSpacer();
959  }
960 
961  $tb->addButton(
962  $this->lng->txt('role_mailto'),
963  $this->ctrl->getLinkTarget($this, 'mailToRole')
964  );
965  $this->tpl->setVariable('BUTTONS_UA', $tb->getHTML());
966 
967  $role_assignment_editable = true;
968  if (
969  $this->object->getId() == SYSTEM_ROLE_ID &&
970  !ilSecuritySettings::_getInstance()->checkAdminRoleAccessible($ilUser->getId())) {
971  $role_assignment_editable = false;
972  }
973  $ut = new ilAssignedUsersTableGUI(
974  $this,
975  'userassignment',
976  $this->object->getId(),
977  $role_assignment_editable,
978  $this->getAdminMode() === self::ADMIN_MODE_SETTINGS
979  );
980  $this->tpl->setVariable('TABLE_UA', $ut->getHTML());
981  }
const SYSTEM_ROLE_ID
Definition: constants.php:29
checkAccess(string $a_perm_global, string $a_perm_obj='')
global $DIC
Definition: feed.php:28
header include for all ilias files.
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...
$ilUser
Definition: imgupload.php:34
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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 42 of file class.ilObjRoleGUI.php.

Referenced by getContainerType().

◆ $help

ilHelpGUI ilObjRoleGUI::$help
protected

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

◆ $http

GlobalHttpState ilObjRoleGUI::$http
private

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

◆ $logger

ilLogger ilObjRoleGUI::$logger
private

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

◆ $obj_obj_id

int ilObjRoleGUI::$obj_obj_id = 0
protected

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

Referenced by getParentObjId().

◆ $obj_obj_type

string ilObjRoleGUI::$obj_obj_type = ''
protected

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

Referenced by getParentType().

◆ $obj_ref_id

◆ $rbacadmin

ilRbacAdmin ilObjRoleGUI::$rbacadmin
protected

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

◆ $refinery

Factory ilObjRoleGUI::$refinery
protected

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

◆ $role_id

int ilObjRoleGUI::$role_id = 0
protected

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

Referenced by getRoleId().

◆ MODE_GLOBAL_CREATE

const ilObjRoleGUI::MODE_GLOBAL_CREATE = 2
protected

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

◆ MODE_GLOBAL_UPDATE

const ilObjRoleGUI::MODE_GLOBAL_UPDATE = 1
protected

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

◆ MODE_LOCAL_CREATE

const ilObjRoleGUI::MODE_LOCAL_CREATE = 4
protected

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

◆ MODE_LOCAL_UPDATE

const ilObjRoleGUI::MODE_LOCAL_UPDATE = 3
protected

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


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