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

This class displays the permission status of a user concerning a specific object. More...

+ Collaboration diagram for ilObjectPermissionStatusGUI:

Public Member Functions

 __construct (&$a_obj)
 Constructor public.
executeCommand ()
 execute command
 perminfo ()
 cmd function
 addToolbar ()
 Creates Toolbar entries.
 accessStatusInfo ()
 Access- and Statusinformation Info.
 accessPermissionsTable ()
 Access Permissions Table.
 availableRolesTable ()
 Available Roles Table.
 getAssignedValidRoles ()
 get Assigned Valid Roles
 getCommands ($a_type)
 get Commands
 getUser ()
 ilUser
 getAccessStatusInfoData ()
 Access Status Info Data.
 getAccessPermissionTableData ()
 Access Permissions Table Data.
 getAvailableRolesTableData ()
 Available Roles Table Data.

Data Fields

 $user
 $lng
 $ilCtrl
 $tpl
 $object
 $rbacreview
 $user_roles
 $global_roles
 $valid_roles
 $assigned_valid_roles
const IMG_OK = 0
const IMG_NOT_OK = 1

Detailed Description

This class displays the permission status of a user concerning a specific object.

("Permissions" -> "Permission of User")

Author
Sascha Hofmann sasch.nosp@m.ahof.nosp@m.mann@.nosp@m.gmx..nosp@m.de
Version
Id:
class.ilObjectPermissionStatusGUI.php 52453 2014-08-20 14:47:52Z smeyer

ilObjectPermissionStatusGUI: ilRepositorySearchGUI

Definition at line 15 of file class.ilObjectPermissionStatusGUI.php.

Constructor & Destructor Documentation

ilObjectPermissionStatusGUI::__construct ( $a_obj)

Constructor public.

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

References $ilCtrl, $lng, $rbacreview, $tpl, getAssignedValidRoles(), and getUser().

{
$this->lng = $lng;
$this->ilCtrl = $ilCtrl;
$this->tpl = $tpl;
$this->object = $a_obj;
$this->rbacreview = $rbacreview;
$this->user = $this->getUser();
$this->user_roles = $rbacreview->assignedRoles($this->user->getId());
$this->global_roles = $rbacreview->getGlobalRoles();
$this->valid_roles = $rbacreview->getParentRoleIds($this->object->getRefId());
$this->assigned_valid_roles = $this->getAssignedValidRoles();
}

+ Here is the call graph for this function:

Member Function Documentation

ilObjectPermissionStatusGUI::accessPermissionsTable ( )

Access Permissions Table.

Returns
string HTML

Definition at line 154 of file class.ilObjectPermissionStatusGUI.php.

References getAccessPermissionTableData().

Referenced by perminfo().

{
include_once("./Services/AccessControl/classes/class.ilAccessPermissionsStatusTableGUI.php");
$table = new ilAccessPermissionsStatusTableGUI($this, "perminfo");
$table->setData($this->getAccessPermissionTableData());
$table->setTitle($this->lng->txt("info_access_permissions"));
return $table->getHTML();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjectPermissionStatusGUI::accessStatusInfo ( )

Access- and Statusinformation Info.

Returns
string HTML

Definition at line 133 of file class.ilObjectPermissionStatusGUI.php.

References getAccessStatusInfoData(), and ilCtrl\getFormAction().

Referenced by perminfo().

{
include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
$info = new ilInfoScreenGUI(new stdClass());
$info->setFormAction($this->ilCtrl->getFormAction($this));
$info->addSection($this->lng->txt("info_access_and_status_info"));
foreach($this->getAccessStatusInfoData() as $data)
{
$info->addProperty($data[0], $data[1]);
}
return $info->getHTML();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjectPermissionStatusGUI::addToolbar ( )

Creates Toolbar entries.

Definition at line 106 of file class.ilObjectPermissionStatusGUI.php.

References ilCtrl\getFormAction(), ilCtrl\getLinkTargetByClass(), and ilTextInputGUI\setDataSource().

Referenced by perminfo().

{
global $ilToolbar;
$ilToolbar->setFormAction($this->ilCtrl->getFormAction($this, "perminfo"));
$ilToolbar->addText($this->lng->txt('user'));
include_once("./Services/Form/classes/class.ilTextInputGUI.php");
$login = new ilTextInputGUI($this->lng->txt("username"), "user_login");
$login->setDataSource($this->ilCtrl->getLinkTargetByClass(array(get_class($this),
'ilRepositorySearchGUI'), 'doUserAutoComplete', '', true));
$login->setSize(15);
$login->setValue($this->user->getLogin());
$ilToolbar->addInputItem($login);
$ilToolbar->addFormButton($this->lng->txt("info_change_user_view"), "perminfo");
//$ilToolbar->addText($lng->txt("info_enter_login_or_id"));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjectPermissionStatusGUI::availableRolesTable ( )

Available Roles Table.

Returns
string HTML

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

References getAvailableRolesTableData().

Referenced by perminfo().

{
include_once("./Services/AccessControl/classes/class.ilAvailableRolesStatusTableGUI.php");
$table = new ilAvailableRolesStatusTableGUI($this, "perminfo");
$table->setData($this->getAvailableRolesTableData());
$table->setTitle($this->lng->txt("info_available_roles"));
return $table->getHTML();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

& ilObjectPermissionStatusGUI::executeCommand ( )

execute command

Definition at line 63 of file class.ilObjectPermissionStatusGUI.php.

References $cmd, $ilCtrl, ilCtrl\forwardCommand(), ilCtrl\getCmd(), ilCtrl\getNextClass(), and ilCtrl\setReturn().

{
global $ilCtrl;
// determine next class in the call structure
$next_class = $this->ilCtrl->getNextClass($this);
switch($next_class)
{
case 'ilrepositorysearchgui':
include_once('./Services/Search/classes/class.ilRepositorySearchGUI.php');
$rep_search =& new ilRepositorySearchGUI();
$this->ilCtrl->setReturn($this,'perminfo');
$this->ilCtrl->forwardCommand($rep_search);
break;
default:
$cmd = $this->ilCtrl->getCmd();
$this->$cmd();
break;
}
}

+ Here is the call graph for this function:

ilObjectPermissionStatusGUI::getAccessPermissionTableData ( )

Access Permissions Table Data.

Returns
array

Definition at line 367 of file class.ilObjectPermissionStatusGUI.php.

References ilRbacReview\_getOperationList(), getAssignedValidRoles(), IMG_NOT_OK, and ilPlugin\lookupTxt().

Referenced by accessPermissionsTable().

{
global $ilAccess,$ilObjDataCache,$objDefinition;
// get all possible operation of current object
$ops_list = ilRbacReview::_getOperationList($this->object->getType());
$counter = 0;
$result_set = array();
// check permissions of user
foreach ($ops_list as $ops)
{
$access = $ilAccess->doRBACCheck($ops['operation'],"info",$this->object->getRefId(),$this->user->getId(),$this->object->getType());
$result_set[$counter]["img"] = $access ? self::IMG_OK : self::IMG_NOT_OK;
if (substr($ops['operation'], 0, 7) == "create_" &&
$objDefinition->isPlugin(substr($ops['operation'], 7)))
{
$result_set[$counter]["operation"] = ilPlugin::lookupTxt("rep_robj", substr($ops['operation'],7),
#$this->object->getType()."_".$ops['operation']);
'rbac_'.$ops['operation']);
}
else if ($objDefinition->isPlugin($this->object->getType()))
{
$result_set[$counter]["operation"] = ilPlugin::lookupTxt("rep_robj", $this->object->getType(),
$this->object->getType()."_".$ops['operation']);
}
elseif(substr($ops['operation'],0,7) == 'create_')
{
$result_set[$counter]["operation"] = $this->lng->txt('rbac_'.$ops['operation']);
}
else
{
$result_set[$counter]["operation"] = $this->lng->txt($this->object->getType()."_".$ops['operation']);
}
$list_role = "";
// Check ownership
if($this->user->getId() == $ilObjDataCache->lookupOwner($this->object->getId()))
{
if(
(substr($ops['operation'],0,7) != 'create_') and
($ops['operation'] != 'edit_permission') and
($ops['operation'] != 'edit_leanring_progress')
)
{
$list_role[] = $this->lng->txt('info_owner_of_object');
}
}
// get operations on object for each assigned role to user
foreach ($this->getAssignedValidRoles() as $role)
{
if (in_array($ops['ops_id'],$role['ops']))
{
$list_role[] = $role['translation'];
}
}
if (empty($list_role))
{
$list_role[] = $this->lng->txt('none');
}
$result_set[$counter]["role_ownership"] = $list_role;
++$counter;
}
return $result_set;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjectPermissionStatusGUI::getAccessStatusInfoData ( )

Access Status Info Data.

Returns
array

Definition at line 283 of file class.ilObjectPermissionStatusGUI.php.

References $assigned_valid_roles, $cmd, getAssignedValidRoles(), getCommands(), and IL_NO_PARENT_ACCESS.

Referenced by accessStatusInfo().

{
global $ilAccess;
$infos = array();
$result_set[0][] = $this->lng->txt("info_view_of_user");
$result_set[0][] = $this->user->getFullname()." (#".$this->user->getId().")";
foreach ($this->getAssignedValidRoles() as $role)
{
$assigned_valid_roles[] = $role["translation"];
}
$roles_str = implode(", ",$assigned_valid_roles);
$result_set[1][] = $this->lng->txt("roles");
$result_set[1][] = $roles_str;
$result_set[2][] = $this->lng->txt("status");
$ilAccess->clear();
$ilAccess->checkAccessOfUser(
$this->user->getId(),
'read',
'',
$this->object->getRefId(),
$this->object->getType(),
$this->object->getId()
);
$infos = array_merge($infos,$ilAccess->getInfo());
$cmds = $this->getCommands($this->object->getType());
foreach ($cmds as $cmd)
{
$ilAccess->clear();
$ilAccess->doStatusCheck($cmd['permission'],$cmd['cmd'],$this->object->getRefId(),$this->user->getId(),$this->object->getId(),$this->object->getType());
$infos = array_merge($infos,$ilAccess->getInfo());
}
$alert = "il_ItemAlertProperty";
$okay = "il_ItemOkayProperty";
$text = "";
if (!$infos)
{
$text = "<span class=\"".$okay."\">".$this->lng->txt("access")."</span><br/> ";
}
else
{
foreach ($infos as $info)
{
switch ($info['type'])
{
case IL_STATUS_MESSAGE:
$text .= "<span class=\"".$okay."\">".$info['text']."</span><br/> ";
break;
$factory = new ilObjectFactory();
$obj = $factory->getInstanceByRefId($info['data']);
$text .= "<span class=\"".$alert."\">".$info['text']." (".$this->lng->txt("obj_".$obj->getType())." #".$obj->getId().": ".$obj->getTitle().")</span><br/> ";
break;
default:
$text .= "<span class=\"".$alert."\">".$info['text']."</span><br/> ";
break;
}
}
}
$result_set[2][] = $text;
return $result_set;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjectPermissionStatusGUI::getAssignedValidRoles ( )

get Assigned Valid Roles

Returns
array

Definition at line 186 of file class.ilObjectPermissionStatusGUI.php.

References $assigned_valid_roles, ilRbacReview\_getOperationList(), and ilObjRole\_getTranslation().

Referenced by __construct(), getAccessPermissionTableData(), and getAccessStatusInfoData().

{
include_once ('./Services/AccessControl/classes/class.ilObjRole.php');
foreach ($this->valid_roles as $role)
{
if (in_array($role['obj_id'],$this->user_roles))
{
if ($role["obj_id"] == SYSTEM_ROLE_ID)
{
// get all possible operation of current object
$ops_list = ilRbacReview::_getOperationList($this->object->getType());
foreach ($ops_list as $ops_data)
{
$ops[] = (int) $ops_data['ops_id'];
}
$role['ops'] = $ops;
}
else
{
$role['ops'] = $this->rbacreview->getRoleOperationsOnObject($role["obj_id"],$this->object->getRefId());
}
include_once('./Services/AccessControl/classes/class.ilObjRole.php');
$role['translation'] = str_replace(" ","&nbsp;",ilObjRole::_getTranslation($role["title"]));
}
}
$this->assigned_valid_roles = $assigned_valid_roles;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjectPermissionStatusGUI::getAvailableRolesTableData ( )

Available Roles Table Data.

Returns
array

Definition at line 446 of file class.ilObjectPermissionStatusGUI.php.

References $path, ilObjRole\_getTranslation(), and IMG_NOT_OK.

Referenced by availableRolesTable().

{
global $tree;
include_once('./Services/AccessControl/classes/class.ilObjRole.php');
$path = array_reverse($tree->getPathId($this->object->getRefId()));
include_once ('./Services/AccessControl/classes/class.ilObjRole.php');
$counter = 0;
foreach ($this->valid_roles as $role)
{
$result_set[$counter]["img"] = in_array($role['obj_id'],$this->user_roles) ? self::IMG_OK : self::IMG_NOT_OK;
$result_set[$counter]["role"] = str_replace(" ","&nbsp;",ilObjRole::_getTranslation($role["title"]));
if ($role['role_type'] != "linked")
{
$result_set[$counter]["effective_from"] = "";
}
else
{
$rolfs = $this->rbacreview->getFoldersAssignedToRole($role["obj_id"]);
// ok, try to match the next rolf in path
foreach ($path as $node)
{
if ($node == 1)
{
break;
}
if (in_array($node,$rolfs))
{
$nodedata = $tree->getNodeData($node);
$result_set[$counter]["effective_from"] = $nodedata["title"];
$result_set[$counter]["effective_from_ref_id"] = $node;
break;
}
}
}
if (in_array($role['obj_id'],$this->global_roles))
{
$result_set[$counter]["original_position"] = $this->lng->txt("global");
$result_set[$counter]["original_position_ref_id"] = false;
}
else
{
$rolf = $this->rbacreview->getFoldersAssignedToRole($role["obj_id"],true);
$parent_node = $tree->getNodeData($rolf[0]);
$result_set[$counter]["original_position"] = $parent_node["title"];
$result_set[$counter]["original_position_ref_id"] = $parent_node["ref_id"];
}
++$counter;
}
return $result_set;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjectPermissionStatusGUI::getCommands (   $a_type)

get Commands

Parameters
$a_typestring
Returns
array

Definition at line 228 of file class.ilObjectPermissionStatusGUI.php.

References $location.

Referenced by getAccessStatusInfoData().

{
global $objDefinition;
$class = $objDefinition->getClassName($a_type);
$location = $objDefinition->getLocation($a_type);
$full_class = "ilObj".$class."Access";
include_once($location."/class.".$full_class.".php");
$cmds = call_user_func(array($full_class, "_getCommands"));
array_push($cmds,array('permission' => 'visible','cmd' => 'info'));
return $cmds;
}

+ Here is the caller graph for this function:

ilObjectPermissionStatusGUI::getUser ( )

ilUser

Returns
ilObjUser|object

Definition at line 248 of file class.ilObjectPermissionStatusGUI.php.

References $_POST, $ilUser, $user, ilObjUser\_lookupId(), ilUtil\sendFailure(), and ilUtil\sendInfo().

Referenced by __construct().

{
global $ilUser;
if (!isset($_POST['user_login']))
{
}
else
{
include_once('Services/User/classes/class.ilObjUser.php');
$user_id = ilObjUser::_lookupId($_POST['user_login']);
$factory = new ilObjectFactory();
$user = $factory->getInstanceByObjId($user_id,false);
if ($user === false or $user->getType() != 'usr')
{
ilUtil::sendFailure($this->lng->txt('info_err_user_not_exist'));
}
else
{
ilUtil::sendInfo($this->lng->txt('info_user_view_changed'));
}
}
return $user;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjectPermissionStatusGUI::perminfo ( )

cmd function

Definition at line 89 of file class.ilObjectPermissionStatusGUI.php.

References $tpl, accessPermissionsTable(), accessStatusInfo(), addToolbar(), and availableRolesTable().

{
$tpl = new ilTemplate("tpl.info_layout.html", false, false, "Services/AccessControl");
$tpl->setVariable("INFO_SUMMARY",$this->accessStatusInfo());
$tpl->setVariable("INFO_PERMISSIONS",$this->accessPermissionsTable());
$tpl->setVariable("INFO_ROLES",$this->availableRolesTable());
$tpl->setVariable("INFO_REMARK_INTERRUPTED",$this->lng->txt('info_remark_interrupted'));
$this->tpl->setVariable("ADM_CONTENT", $tpl->get());
$this->addToolbar();
}

+ Here is the call graph for this function:

Field Documentation

ilObjectPermissionStatusGUI::$assigned_valid_roles
ilObjectPermissionStatusGUI::$global_roles

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

ilObjectPermissionStatusGUI::$ilCtrl

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

Referenced by __construct(), and executeCommand().

ilObjectPermissionStatusGUI::$lng

Definition at line 20 of file class.ilObjectPermissionStatusGUI.php.

Referenced by __construct().

ilObjectPermissionStatusGUI::$object

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

ilObjectPermissionStatusGUI::$rbacreview

Definition at line 28 of file class.ilObjectPermissionStatusGUI.php.

Referenced by __construct().

ilObjectPermissionStatusGUI::$tpl

Definition at line 24 of file class.ilObjectPermissionStatusGUI.php.

Referenced by __construct(), and perminfo().

ilObjectPermissionStatusGUI::$user

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

Referenced by getUser().

ilObjectPermissionStatusGUI::$user_roles

Definition at line 29 of file class.ilObjectPermissionStatusGUI.php.

ilObjectPermissionStatusGUI::$valid_roles

Definition at line 31 of file class.ilObjectPermissionStatusGUI.php.

const ilObjectPermissionStatusGUI::IMG_NOT_OK = 1
const ilObjectPermissionStatusGUI::IMG_OK = 0

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