ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilLocalUserGUI Class Reference

Class ilLocalUserGUI. More...

+ Collaboration diagram for ilLocalUserGUI:

Public Member Functions

 __construct ($parent_gui)
 executeCommand ()
 index ($show_delete=false)
 performDeleteUsers ()
 Delete User.
 deleteUsers ()
 assignRoles ()
 assignSave ()
 __checkGlobalRoles ($new_assigned)
 __getAssignableRoles ()
 __showRolesTable ($a_result_set, $a_from="")

Data Fields

 $object

Protected Member Functions

 resetFilter ()
 Reset filter (note: this function existed before data table filter has been introduced.
 applyFilter ()
 Apply filter.
 addUserAutoCompleteObject ()
 Show auto complete results.
 checkPermission ($permission)

Protected Attributes

 $tabs_gui
 $form
 $toolbar
 $ctrl
 $tpl
 $lng
 $ilAccess

Detailed Description

Constructor & Destructor Documentation

ilLocalUserGUI::__construct (   $parent_gui)
Parameters
$parent_gui

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

References $ilAccess, $ilCtrl, $lng, $tpl, and ilUtil\sendFailure().

{
global $tpl, $ilCtrl, $ilTabs, $ilToolbar, $lng, $rbacsystem, $ilAccess;
$this->tpl = $tpl;
$this->ctrl = $ilCtrl;
$this->parent_gui = $parent_gui;
$this->object = $parent_gui->object;
$this->tabs_gui = $this->parent_gui->tabs_gui;
$this->toolbar = $ilToolbar;
$this->lng = $lng;
$this->ilAccess = $ilAccess;
$this->lng->loadLanguageModule('user');
if (! $rbacsystem->checkAccess("cat_administrate_users", $this->parent_gui->object->getRefId())) {
ilUtil::sendFailure($this->lng->txt("msg_no_perm_admin_users"), true);
}
}

+ Here is the call graph for this function:

Member Function Documentation

ilLocalUserGUI::__checkGlobalRoles (   $new_assigned)

Definition at line 302 of file class.ilLocalUserGUI.php.

References $_GET, $_REQUEST, $ilUser, ilObjectFactory\getInstanceByObjId(), and ilUtil\sendFailure().

Referenced by assignSave().

{
global $rbacreview, $ilUser;
if (! $this->ilAccess->checkAccess("cat_administrate_users", "", $_GET["ref_id"])) {
ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
$this->ctrl->redirect($this, "");
}
// return true if it's not a local user
if ($tmp_obj->getTimeLimitOwner() != $this->object->getRefId() and
! in_array(SYSTEM_ROLE_ID, $rbacreview->assignedRoles($ilUser->getId()))
) {
return true;
}
// new assignment by form
$new_assigned = $new_assigned ? $new_assigned : array();
$assigned = $rbacreview->assignedRoles((int)$_GET['obj_id']);
// all assignable globals
if (! in_array(SYSTEM_ROLE_ID, $rbacreview->assignedRoles($ilUser->getId()))) {
$ga = $rbacreview->getGlobalAssignableRoles();
} else {
$ga = $rbacreview->getGlobalRolesArray();
}
$global_assignable = array();
foreach ($ga as $role) {
$global_assignable[] = $role['obj_id'];
}
$new_visible_assigned_roles = array_intersect($new_assigned, $global_assignable);
$all_assigned_roles = array_intersect($assigned, $rbacreview->getGlobalRoles());
$main_assigned_roles = array_diff($all_assigned_roles, $global_assignable);
if (! count($new_visible_assigned_roles) and ! count($main_assigned_roles)) {
return false;
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLocalUserGUI::__getAssignableRoles ( )

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

References $_REQUEST, $ilUser, and ilObjectFactory\getInstanceByObjId().

Referenced by assignRoles(), and assignSave().

{
global $rbacreview, $ilUser;
// check local user
// Admin => all roles
if (in_array(SYSTEM_ROLE_ID, $rbacreview->assignedRoles($ilUser->getId()))) {
$global_roles = $rbacreview->getGlobalRolesArray();
} elseif ($tmp_obj->getTimeLimitOwner() == $this->object->getRefId()) {
$global_roles = $rbacreview->getGlobalAssignableRoles();
} else {
$global_roles = array();
}
return $roles = array_merge($global_roles, $rbacreview->getAssignableChildRoles($this->object->getRefId()));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLocalUserGUI::__showRolesTable (   $a_result_set,
  $a_from = "" 
)

Definition at line 356 of file class.ilLocalUserGUI.php.

References $_GET, $tpl, ilUtil\getImagePath(), ilObjectFactory\getInstanceByObjId(), and ilUtil\sendFailure().

Referenced by assignRoles().

{
if (! $this->ilAccess->checkAccess("cat_administrate_users", "", $_GET["ref_id"])) {
ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
$this->ctrl->redirect($this, "");
}
$tbl =& $this->parent_gui->__initTableGUI();
$tpl =& $tbl->getTemplateObject();
// SET FORMAACTION
$tpl->setCurrentBlock("tbl_form_header");
$this->ctrl->setParameter($this, 'obj_id', $_GET['obj_id']);
$tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
$tpl->parseCurrentBlock();
// SET FOOTER BUTTONS
$tpl->setVariable("COLUMN_COUNTS", 4);
$tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.svg"));
$tpl->setCurrentBlock("tbl_action_button");
$tpl->setVariable("BTN_NAME", "assignSave");
$tpl->setVariable("BTN_VALUE", $this->lng->txt("change_assignment"));
$tpl->parseCurrentBlock();
$tpl->setCurrentBlock("tbl_action_row");
$tpl->setVariable("TPLPATH", $this->tpl->tplPath);
$tpl->parseCurrentBlock();
$title = $this->lng->txt('role_assignment') . ' (' . $tmp_obj->getFullname() . ')';
$tbl->setTitle($title, "icon_role.svg", $this->lng->txt("role_assignment"));
$tbl->setHeaderNames(array(
'',
$this->lng->txt("title"),
$this->lng->txt('description'),
$this->lng->txt("type")
));
$tbl->setHeaderVars(array(
"",
"title",
"description",
"type"
), array(
"ref_id" => $this->object->getRefId(),
"cmd" => "assignRoles",
"obj_id" => $_GET['obj_id'],
"cmdClass" => "ilobjcategorygui",
"cmdNode" => $_GET["cmdNode"]
));
$tbl->setColumnWidth(array( "4%", "35%", "45%", "16%" ));
$this->set_unlimited = true;
$this->parent_gui->__setTableGUIBasicData($tbl, $a_result_set, $a_from, true);
$tbl->render();
$this->tpl->setVariable("ROLES_TABLE", $tbl->tpl->get());
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLocalUserGUI::addUserAutoCompleteObject ( )
protected

Show auto complete results.

Definition at line 152 of file class.ilLocalUserGUI.php.

References $_REQUEST, exit, and ilUserAutoComplete\MAX_ENTRIES.

{
include_once './Services/User/classes/class.ilUserAutoComplete.php';
$auto = new ilUserAutoComplete();
$auto->setSearchFields(array( 'login', 'firstname', 'lastname', 'email' ));
$auto->enableFieldSearchableCheck(true);
$auto->setMoreLinkAvailable(true);
if(($_REQUEST['fetchall']))
{
}
echo $auto->getList($_REQUEST['query']);
exit();
}
ilLocalUserGUI::applyFilter ( )
protected

Apply filter.

Returns

Definition at line 108 of file class.ilLocalUserGUI.php.

References index(), and ilUserTableGUI\MODE_LOCAL_USER.

{
$table = new ilUserTableGUI($this, "index", ilUserTableGUI::MODE_LOCAL_USER);
$table->resetOffset();
$table->writeFilterToSession();
$this->index();
}

+ Here is the call graph for this function:

ilLocalUserGUI::assignRoles ( )

Definition at line 219 of file class.ilLocalUserGUI.php.

References $_GET, __getAssignableRoles(), __showRolesTable(), ilUtil\formCheckbox(), ilObjectFactory\getInstanceByObjId(), index(), and ilUtil\sendFailure().

Referenced by assignSave().

{
global $rbacreview;
if (! $this->ilAccess->checkAccess("cat_administrate_users", "", $_GET["ref_id"])) {
ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
$this->ctrl->redirect($this, "");
}
$offset = $_GET["offset"];
// init sort_by (unfortunatly sort_by is preset with 'title'
if ($_GET["sort_by"] == "title" or empty($_GET["sort_by"])) {
$_GET["sort_by"] = "login";
}
$order = $_GET["sort_by"];
$direction = $_GET["sort_order"];
include_once './Services/User/classes/class.ilLocalUser.php';
if (! isset($_GET['obj_id'])) {
ilUtil::sendFailure('no_user_selected');
$this->index();
return true;
}
$roles = $this->__getAssignableRoles();
$this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.cat_role_assignment.html',
"Modules/Category");
$ass_roles = $rbacreview->assignedRoles($_GET['obj_id']);
$counter = 0;
foreach ($roles as $role) {
$role_obj =& ilObjectFactory::getInstanceByObjId($role['obj_id']);
$disabled = false;
$f_result[$counter][] = ilUtil::formCheckbox(in_array($role['obj_id'], $ass_roles) ? 1 : 0,
'role_ids[]',
$role['obj_id'],
$disabled);
$f_result[$counter][] = $role_obj->getTitle();
$f_result[$counter][] = $role_obj->getDescription();
$f_result[$counter][] = $role['role_type'] == 'global' ?
$this->lng->txt('global') :
$this->lng->txt('local');
unset($role_obj);
++$counter;
}
$this->__showRolesTable($f_result, "assignRolesObject");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLocalUserGUI::assignSave ( )

Definition at line 263 of file class.ilLocalUserGUI.php.

References $_GET, $_POST, $_REQUEST, __checkGlobalRoles(), __getAssignableRoles(), ilLocalUser\_getAllUserIds(), assignRoles(), index(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

{
global $rbacreview, $rbacadmin;
if (! $this->ilAccess->checkAccess("cat_administrate_users", "", $_GET["ref_id"])) {
ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
$this->ctrl->redirect($this, "");
}
include_once './Services/User/classes/class.ilLocalUser.php';
// check hack
if (! isset($_GET['obj_id']) or ! in_array($_REQUEST['obj_id'], ilLocalUser::_getAllUserIds())) {
ilUtil::sendFailure('no_user_selected');
$this->index();
return true;
}
$roles = $this->__getAssignableRoles();
// check minimum one global role
if (! $this->__checkGlobalRoles($_POST['role_ids'])) {
ilUtil::sendFailure($this->lng->txt('no_global_role_left'));
$this->assignRolesObject();
return false;
}
$new_role_ids = $_POST['role_ids'] ? $_POST['role_ids'] : array();
$assigned_roles = $rbacreview->assignedRoles((int)$_REQUEST['obj_id']);
foreach ($roles as $role) {
if (in_array($role['obj_id'], $new_role_ids) and ! in_array($role['obj_id'], $assigned_roles)) {
$rbacadmin->assignUser($role['obj_id'], (int)$_REQUEST['obj_id']);
}
if (in_array($role['obj_id'], $assigned_roles) and ! in_array($role['obj_id'], $new_role_ids)) {
$rbacadmin->deassignUser($role['obj_id'], (int)$_REQUEST['obj_id']);
}
}
ilUtil::sendSuccess($this->lng->txt('role_assignment_updated'));
$this->assignRoles();
return true;
}

+ Here is the call graph for this function:

ilLocalUserGUI::checkPermission (   $permission)
protected
Parameters
$permission

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

References $_GET, and ilUtil\sendFailure().

Referenced by deleteUsers(), and performDeleteUsers().

{
if (! $this->ilAccess->checkAccess($permission, "", $_GET["ref_id"])) {
ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
$this->ctrl->redirect($this, "");
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLocalUserGUI::deleteUsers ( )

Definition at line 193 of file class.ilLocalUserGUI.php.

References $_POST, ilObjUser\_lookupName(), checkPermission(), index(), and ilUtil\sendFailure().

{
$this->checkPermission("cat_administrate_users");
if (! count($_POST['id'])) {
ilUtil::sendFailure($this->lng->txt('no_users_selected'));
$this->index();
return true;
}
include_once './Services/Utilities/classes/class.ilConfirmationGUI.php';
$confirm = new ilConfirmationGUI();
$confirm->setFormAction($this->ctrl->getFormAction($this));
$confirm->setHeaderText($this->lng->txt('sure_delete_selected_users'));
$confirm->setConfirm($this->lng->txt('delete'), 'performDeleteUsers');
$confirm->setCancel($this->lng->txt('cancel'), 'index');
foreach ($_POST['id'] as $user) {
$name = ilObjUser::_lookupName($user);
$confirm->addItem(
'user_ids[]',
$user,
$name['lastname'] . ', ' . $name['firstname'] . ' [' . $name['login'] . ']'
);
}
$this->tpl->setContent($confirm->getHTML());
}

+ Here is the call graph for this function:

ilLocalUserGUI::executeCommand ( )
Returns
bool

Definition at line 73 of file class.ilLocalUserGUI.php.

References $cmd.

{
$cmd = $this->ctrl->getCmd();
switch ($cmd) {
case "assignRoles":
case "assignSave":
$this->tabs_gui->clearTargets();
$this->tabs_gui->setBackTarget($this->lng->txt("back"),$this->ctrl->getLinkTargetByClass("illocalusergui", 'index'));
$this->$cmd();
break;
default:
$this->$cmd();
break;
}
return true;
}
ilLocalUserGUI::index (   $show_delete = false)

Definition at line 116 of file class.ilLocalUserGUI.php.

References $ilUser, ilUserTableGUI\MODE_LOCAL_USER, and ilUtil\sendInfo().

Referenced by applyFilter(), assignRoles(), assignSave(), deleteUsers(), and resetFilter().

{
global $ilUser, $rbacreview, $rbacsystem;
$this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.cat_admin_users.html',
"Modules/Category");
if (count($rbacreview->getGlobalAssignableRoles())
or in_array(SYSTEM_ROLE_ID, $rbacreview->assignedRoles($ilUser->getId()))
) {
$this->toolbar->addButton(
$this->lng->txt('add_user'),
$this->ctrl->getLinkTargetByClass('ilobjusergui', 'create')
);
$this->toolbar->addButton(
$this->lng->txt('import_users'),
$this->ctrl->getLinkTargetByClass('ilobjuserfoldergui', 'importUserForm')
);
} else {
ilUtil::sendInfo($this->lng->txt('no_roles_user_can_be_assigned_to'));
}
if ($show_delete) {
$this->tpl->setCurrentBlock("confirm_delete");
$this->tpl->setVariable("CONFIRM_FORMACTION", $this->ctrl->getFormAction($this));
$this->tpl->setVariable("TXT_CANCEL", $this->lng->txt('cancel'));
$this->tpl->setVariable("CONFIRM_CMD", 'performDeleteUsers');
$this->tpl->setVariable("TXT_CONFIRM", $this->lng->txt('delete'));
$this->tpl->parseCurrentBlock();
}
$table = new ilUserTableGUI($this, 'index', ilUserTableGUI::MODE_LOCAL_USER);
$this->tpl->setVariable('USERS_TABLE', $table->getHTML());
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLocalUserGUI::performDeleteUsers ( )

Delete User.

Definition at line 172 of file class.ilLocalUserGUI.php.

References $_GET, $_POST, $ilLog, ilLocalUser\_getAllUserIds(), checkPermission(), ilObjectFactory\getInstanceByObjId(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

{
global $ilLog;
include_once './Services/User/classes/class.ilLocalUser.php';
$this->checkPermission("cat_administrate_users");
foreach ($_POST['user_ids'] as $user_id) {
if (! in_array($user_id, ilLocalUser::_getAllUserIds($_GET['ref_id']))) {
$ilLog->write(__FILE__.":".__LINE__." User with id $user_id could not be found.");
ilUtil::sendFailure($this->lng->txt('user_not_found_to_delete'));
}
if (! $tmp_obj =& ilObjectFactory::getInstanceByObjId($user_id, false)) {
continue;
}
$tmp_obj->delete();
}
ilUtil::sendSuccess($this->lng->txt('deleted_users'), true);
$this->ctrl->redirect($this, 'index');
return true;
}

+ Here is the call graph for this function:

ilLocalUserGUI::resetFilter ( )
protected

Reset filter (note: this function existed before data table filter has been introduced.

Definition at line 95 of file class.ilLocalUserGUI.php.

References index(), and ilUserTableGUI\MODE_LOCAL_USER.

{
$table = new ilUserTableGUI($this, "index", ilUserTableGUI::MODE_LOCAL_USER);
$table->resetOffset();
$table->resetFilter();
$this->index();
}

+ Here is the call graph for this function:

Field Documentation

ilLocalUserGUI::$ctrl
protected

Definition at line 30 of file class.ilLocalUserGUI.php.

ilLocalUserGUI::$form
protected

Definition at line 22 of file class.ilLocalUserGUI.php.

ilLocalUserGUI::$ilAccess
protected

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

Referenced by __construct().

ilLocalUserGUI::$lng
protected

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

Referenced by __construct().

ilLocalUserGUI::$object

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

ilLocalUserGUI::$tabs_gui
protected

Definition at line 18 of file class.ilLocalUserGUI.php.

ilLocalUserGUI::$toolbar
protected

Definition at line 26 of file class.ilLocalUserGUI.php.

ilLocalUserGUI::$tpl
protected

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

Referenced by __construct(), and __showRolesTable().


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