This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.
More...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.
ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.
If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class ilLocalUserGUI
- Author
- Oskar Truffer ot@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch
-
Martin Studer ms@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch
Definition at line 26 of file class.ilLocalUserGUI.php.
◆ __construct()
Definition at line 44 of file class.ilLocalUserGUI.php.
References $DIC, $parentGui, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ilObjectGUI\getObject(), ILIAS\Repository\lng(), ILIAS\Repository\logger(), ILIAS\Repository\toolbar(), and ILIAS\Repository\user().
50 $this->tpl = $DIC->ui()->mainTemplate();
51 $this->
ctrl = $DIC->ctrl();
52 $this->
toolbar = $DIC->toolbar();
53 $this->
lng = $DIC->language();
54 $this->rbacSystem = $DIC->rbac()->system();
55 $this->rbacReview = $DIC->rbac()->review();
56 $this->rbacAdmin = $DIC->rbac()->admin();
57 $this->
user = $DIC->user();
58 $this->
access = $DIC->access();
59 $this->tabsGui = $DIC->tabs();
60 $this->
logger = $DIC->logger();
62 $this->
lng->loadLanguageModule(
'user');
63 if (!$this->rbacSystem->checkAccess(
"cat_administrate_users", $this->parentGui->getObject()->getRefId())) {
64 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"msg_no_perm_admin_users"),
true);
◆ addUserAutoCompleteObject()
ilLocalUserGUI::addUserAutoCompleteObject |
( |
| ) |
|
|
protected |
Definition at line 145 of file class.ilLocalUserGUI.php.
References exit, and ilUserAutoComplete\MAX_ENTRIES.
148 $auto->setSearchFields(array(
'login',
'firstname',
'lastname',
'email'));
149 $auto->enableFieldSearchableCheck(
true);
150 $auto->setMoreLinkAvailable(
true);
152 if (($_REQUEST[
'fetchall'])) {
156 echo $auto->getList($_REQUEST[
'term']);
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
◆ applyFilter()
ilLocalUserGUI::applyFilter |
( |
| ) |
|
|
protected |
◆ assignRoles()
ilLocalUserGUI::assignRoles |
( |
| ) |
|
- Exceptions
-
Definition at line 209 of file class.ilLocalUserGUI.php.
References $_GET, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ilLegacyFormElementsUtil\formCheckbox(), getAssignableRoles(), ilObjectFactory\getInstanceByObjId(), index(), ILIAS\Repository\lng(), and showRolesTable().
Referenced by assignSave().
211 if (!$this->
access->checkAccess(
"cat_administrate_users",
"",
$_GET[
"ref_id"])) {
212 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"permission_denied"),
true);
213 $this->
ctrl->redirect($this,
"");
215 $offset = isset(
$_GET[
"offset"]) ?
$_GET[
"offset"] : 0;
217 if (!isset(
$_GET[
"sort_by"]) ||
$_GET[
"sort_by"] ==
"title" || empty(
$_GET[
"sort_by"])) {
220 $order =
$_GET[
"sort_by"];
223 $direction = isset(
$_GET[
"sort_order"]) ?
$_GET[
"sort_order"] :
'asc';
224 if (!isset(
$_GET[
'obj_id'])) {
225 $this->tpl->setOnScreenMessage(
'failure',
'no_user_selected');
230 $this->tpl->addBlockfile(
233 'tpl.cat_role_assignment.html',
236 $ass_roles = $this->rbacReview->assignedRoles(
$_GET[
'obj_id']);
238 foreach ($roles as $role) {
242 in_array($role[
'obj_id'], $ass_roles) ? 1 : 0,
247 $f_result[$counter][] = $role_obj->getTitle();
248 $f_result[$counter][] = $role_obj->getDescription() ? $role_obj->getDescription() :
'';
249 $f_result[$counter][] = (isset($role[
'role_type']) && $role[
'role_type'] ==
'global')
251 $this->
lng->txt(
'global')
253 $this->
lng->txt(
'local');
index(bool $show_delete=false)
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
showRolesTable($a_result_set, $a_from="")
◆ assignSave()
ilLocalUserGUI::assignSave |
( |
| ) |
|
Definition at line 260 of file class.ilLocalUserGUI.php.
References $_GET, ilLocalUser\_getAllUserIds(), ILIAS\Repository\access(), assignRoles(), checkGlobalRoles(), ILIAS\Repository\ctrl(), getAssignableRoles(), index(), and ILIAS\Repository\lng().
262 if (!$this->
access->checkAccess(
"cat_administrate_users",
"",
$_GET[
"ref_id"])) {
263 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"permission_denied"),
true);
264 $this->
ctrl->redirect($this,
"");
268 $this->tpl->setOnScreenMessage(
'failure',
'no_user_selected');
276 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'no_global_role_left'));
277 $this->assignRolesObject();
281 $new_role_ids = $_POST[
'role_ids'] ? $_POST[
'role_ids'] : array();
282 $assigned_roles = $this->rbacReview->assignedRoles((
int) $_REQUEST[
'obj_id']);
283 foreach ($roles as $role) {
284 if (in_array($role[
'obj_id'], $new_role_ids) and !in_array($role[
'obj_id'], $assigned_roles)) {
285 $this->rbacAdmin->assignUser($role[
'obj_id'], (
int) $_REQUEST[
'obj_id']);
287 if (in_array($role[
'obj_id'], $assigned_roles) and !in_array($role[
'obj_id'], $new_role_ids)) {
288 $this->rbacAdmin->deassignUser($role[
'obj_id'], (
int) $_REQUEST[
'obj_id']);
291 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'role_assignment_updated'));
static _getAllUserIds(int $a_filter=0)
index(bool $show_delete=false)
checkGlobalRoles($new_assigned)
◆ checkGlobalRoles()
ilLocalUserGUI::checkGlobalRoles |
( |
|
$new_assigned | ) |
|
Definition at line 297 of file class.ilLocalUserGUI.php.
References $_GET, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ilObjectFactory\getInstanceByObjId(), ILIAS\Repository\lng(), and SYSTEM_ROLE_ID.
Referenced by assignSave().
299 if (!$this->
access->checkAccess(
"cat_administrate_users",
"",
$_GET[
"ref_id"])) {
300 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"permission_denied"),
true);
301 $this->
ctrl->redirect($this,
"");
305 if ($tmp_obj->getTimeLimitOwner() != $this->
object->getRefId() and
306 !in_array(
SYSTEM_ROLE_ID, $this->rbacReview->assignedRoles($this->user->getId()))
311 $new_assigned = $new_assigned ? $new_assigned : array();
312 $assigned = $this->rbacReview->assignedRoles((
int)
$_GET[
'obj_id']);
314 if (!in_array(
SYSTEM_ROLE_ID, $this->rbacReview->assignedRoles($this->user->getId()))) {
315 $ga = $this->rbacReview->getGlobalAssignableRoles();
317 $ga = $this->rbacReview->getGlobalRolesArray();
319 $global_assignable = array();
320 foreach ($ga as $role) {
321 $global_assignable[] = $role[
'obj_id'];
323 $new_visible_assigned_roles = array_intersect($new_assigned, $global_assignable);
324 $all_assigned_roles = array_intersect($assigned, $this->rbacReview->getGlobalRoles());
325 $main_assigned_roles = array_diff($all_assigned_roles, $global_assignable);
326 if (!count($new_visible_assigned_roles) and !count($main_assigned_roles)) {
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
◆ checkPermission()
ilLocalUserGUI::checkPermission |
( |
string |
$permission | ) |
|
|
protected |
◆ deleteUsers()
ilLocalUserGUI::deleteUsers |
( |
| ) |
|
Definition at line 179 of file class.ilLocalUserGUI.php.
References $name, ilObjUser\_lookupName(), checkPermission(), ILIAS\Repository\ctrl(), index(), and ILIAS\Repository\lng().
182 if (!count($_POST[
'id'])) {
183 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'no_users_selected'));
188 $confirm->setFormAction($this->
ctrl->getFormAction($this));
189 $confirm->setHeaderText($this->
lng->txt(
'sure_delete_selected_users'));
190 $confirm->setConfirm($this->
lng->txt(
'delete'),
'performDeleteUsers');
191 $confirm->setCancel($this->
lng->txt(
'cancel'),
'index');
192 foreach ($_POST[
'id'] as
$user) {
197 $name[
'lastname'] .
', ' .
$name[
'firstname'] .
' [' .
$name[
'login'] .
']' 200 $this->tpl->setContent($confirm->getHTML());
index(bool $show_delete=false)
static _lookupName(int $a_user_id)
lookup user name
checkPermission(string $permission)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
◆ executeCommand()
ilLocalUserGUI::executeCommand |
( |
| ) |
|
◆ getAssignableRoles()
ilLocalUserGUI::getAssignableRoles |
( |
| ) |
|
- Exceptions
-
Definition at line 338 of file class.ilLocalUserGUI.php.
References ilObjectFactory\getInstanceByObjId(), and SYSTEM_ROLE_ID.
Referenced by assignRoles(), and assignSave().
343 if (in_array(
SYSTEM_ROLE_ID, $this->rbacReview->assignedRoles($this->user->getId())) ===
true) {
344 $global_roles = $this->rbacReview->getGlobalRolesArray();
345 } elseif ($tmp_obj->getTimeLimitOwner() == $this->
object->getRefId()) {
346 $global_roles = $this->rbacReview->getGlobalAssignableRoles();
348 $global_roles = array();
351 return array_merge($global_roles, $this->rbacReview->getAssignableChildRoles($this->object->getRefId()));
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
◆ getObject()
ilLocalUserGUI::getObject |
( |
| ) |
|
◆ index()
ilLocalUserGUI::index |
( |
bool |
$show_delete = false | ) |
|
Definition at line 109 of file class.ilLocalUserGUI.php.
References ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ilUserTableGUI\MODE_LOCAL_USER, SYSTEM_ROLE_ID, and ILIAS\Repository\toolbar().
Referenced by applyFilter(), assignRoles(), assignSave(), deleteUsers(), and resetFilter().
111 $this->tpl->addBlockfile(
114 'tpl.cat_admin_users.html',
117 if (count($this->rbacReview->getGlobalAssignableRoles())
118 or in_array(
SYSTEM_ROLE_ID, $this->rbacReview->assignedRoles($this->user->getId()))
121 $this->
lng->txt(
'add_user'),
122 $this->
ctrl->getLinkTargetByClass(
'ilobjusergui',
'create')
125 $this->
lng->txt(
'import_users'),
126 $this->
ctrl->getLinkTargetByClass(
'ilobjuserfoldergui',
'importUserForm')
129 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'no_roles_user_can_be_assigned_to'));
132 $this->tpl->setCurrentBlock(
"confirm_delete");
133 $this->tpl->setVariable(
"CONFIRM_FORMACTION", $this->
ctrl->getFormAction($this));
134 $this->tpl->setVariable(
"TXT_CANCEL", $this->
lng->txt(
'cancel'));
135 $this->tpl->setVariable(
"CONFIRM_CMD",
'performDeleteUsers');
136 $this->tpl->setVariable(
"TXT_CONFIRM", $this->
lng->txt(
'delete'));
137 $this->tpl->parseCurrentBlock();
140 $this->tpl->setVariable(
'USERS_TABLE', $table->getHTML());
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
◆ initTableGUI()
ilLocalUserGUI::initTableGUI |
( |
| ) |
|
|
protected |
◆ performDeleteUsers()
ilLocalUserGUI::performDeleteUsers |
( |
| ) |
|
Definition at line 160 of file class.ilLocalUserGUI.php.
References $_GET, ilLocalUser\_getAllUserIds(), checkPermission(), ILIAS\Repository\ctrl(), ilObjectFactory\getInstanceByObjId(), ILIAS\Repository\lng(), and ILIAS\Repository\logger().
163 foreach ($_POST[
'user_ids'] as $user_id) {
165 $this->
logger->write(__FILE__ .
":" . __LINE__ .
" User with id $user_id could not be found.");
166 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'user_not_found_to_delete'));
173 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'deleted_users'),
true);
174 $this->
ctrl->redirect($this,
'index');
static _getAllUserIds(int $a_filter=0)
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
checkPermission(string $permission)
◆ resetFilter()
ilLocalUserGUI::resetFilter |
( |
| ) |
|
|
protected |
◆ setTableGUIBasicData()
ilLocalUserGUI::setTableGUIBasicData |
( |
|
$tbl, |
|
|
& |
$result_set, |
|
|
string |
$a_from = "" |
|
) |
| |
|
protected |
Definition at line 425 of file class.ilLocalUserGUI.php.
References $_GET, and ILIAS\Repository\lng().
Referenced by showRolesTable().
427 $order = isset(
$_GET[
"sort_by"]) ?
$_GET[
"sort_by"] :
'title';
428 $direction = isset(
$_GET[
"sort_order"]) ?
$_GET[
"sort_order"] :
'asc';
429 $offset = isset(
$_GET[
"offset"]) ?
$_GET[
"offset"] : 0;
430 $limit = isset(
$_GET[
"limit"]) ?
$_GET[
"limit"] : 0;
432 if ($a_from ==
'clipboardObject') $tbl->disable(
"footer");
433 $tbl->disable(
"linkbar");
435 $tbl->setOrderColumn((
string) $order);
436 $tbl->setOrderDirection((
string) $direction);
437 $tbl->setOffset((
int) $offset);
438 $tbl->setLimit((
int) $limit);
439 $tbl->setFooter(
"tblfooter", $this->
lng->txt(
"previous"), $this->
lng->txt(
"next"));
440 $tbl->setData($result_set);
◆ showRolesTable()
ilLocalUserGUI::showRolesTable |
( |
|
$a_result_set, |
|
|
|
$a_from = "" |
|
) |
| |
- Exceptions
-
Definition at line 361 of file class.ilLocalUserGUI.php.
References $_GET, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ilUtil\getImagePath(), ilObjectFactory\getInstanceByObjId(), initTableGUI(), ILIAS\Repository\lng(), ILIAS\Repository\object(), ilGlobalTemplateInterface\parseCurrentBlock(), ilGlobalTemplateInterface\setCurrentBlock(), setTableGUIBasicData(), and ilGlobalTemplateInterface\setVariable().
Referenced by assignRoles().
363 if ($this->
access->checkAccess(
"cat_administrate_users",
"",
$_GET[
"ref_id"]) ===
false) {
364 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"permission_denied"),
true);
365 $this->
ctrl->redirect($this,
"");
368 $tpl = $tbl->getTemplateObject();
371 $this->
ctrl->setParameter($this,
'obj_id',
$_GET[
'obj_id']);
381 $title = $this->
lng->txt(
'role_assignment') .
' (' . $tmp_obj->getFullname() .
')';
382 $tbl->setTitle($title,
"icon_role.svg", $this->
lng->txt(
"role_assignment"));
383 $tbl->setHeaderNames(array(
385 $this->
lng->txt(
"title"),
386 $this->
lng->txt(
'description'),
387 $this->
lng->txt(
"type"),
389 $tbl->setHeaderVars(array(
394 ), (get_class($this->parentGui) ==
'ilObjOrgUnitGUI')
396 "ref_id" => $this->
object->getRefId(),
397 "cmd" =>
"assignRoles",
398 "obj_id" =>
$_GET[
'obj_id'],
399 "cmdNode" =>
$_GET[
"cmdNode"],
400 "baseClass" =>
'ilAdministrationGUI',
401 "admin_mode" =>
"settings",
404 "ref_id" => $this->
object->getRefId(),
405 "cmd" =>
"assignRoles",
406 "obj_id" =>
$_GET[
'obj_id'],
407 "cmdClass" =>
"ilobjcategorygui",
408 "baseClass" =>
'ilRepositoryGUI',
409 "cmdNode" =>
$_GET[
"cmdNode"],
411 $tbl->setColumnWidth(array(
"4%",
"35%",
"45%",
"16%"));
412 $this->set_unlimited =
true;
415 $this->tpl->setVariable(
'OBJECTS', $tbl->getTemplateObject()->get());
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
setVariable(string $variable, $value='')
Sets the given variable to the given value.
ilGlobalTemplateInterface $tpl
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
Sets the template to the given block.
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
parseCurrentBlock(string $block_name=self::DEFAULT_BLOCK)
Parses the given block.
setTableGUIBasicData($tbl, &$result_set, string $a_from="")
◆ $access
◆ $ctrl
◆ $form
◆ $lng
◆ $logger
ILIAS DI LoggingServices ilLocalUserGUI::$logger |
|
private |
◆ $object
◆ $parentGui
◆ $rbacAdmin
◆ $rbacReview
◆ $rbacSystem
◆ $tabsGui
◆ $toolbar
◆ $tpl
◆ $user
The documentation for this class was generated from the following file: