ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 @access public. More...
 
 executeCommand ()
 execute command More...
 
 perminfo ()
 cmd function More...
 
 addToolbar ()
 Creates Toolbar entries. More...
 
 accessStatusInfo ()
 Access- and Statusinformation Info. More...
 
 accessPermissionsTable ()
 Access Permissions Table. More...
 
 availableRolesTable ()
 Available Roles Table. More...
 
 getAssignedValidRoles ()
 get Assigned Valid Roles More...
 
 getCommands ($a_type)
 get Commands More...
 
 getUser ()
 ilUser More...
 
 getAccessStatusInfoData ()
 Access Status Info Data. More...
 
 getAccessPermissionTableData ()
 Access Permissions Table Data. More...
 
 getAvailableRolesTableData ()
 Available Roles Table Data. More...
 

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$

@ilCtrl_Calls ilObjectPermissionStatusGUI: ilRepositorySearchGUI

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

Constructor & Destructor Documentation

◆ __construct()

ilObjectPermissionStatusGUI::__construct ( $a_obj)

Constructor @access public.

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

44 {
46
47 $this->lng = $lng;
48 $this->ilCtrl = $ilCtrl;
49 $this->tpl = $tpl;
50 $this->object = $a_obj;
51 $this->rbacreview = $rbacreview;
52
53 $this->user = $this->getUser();
54 $this->user_roles = $rbacreview->assignedRoles($this->user->getId());
55 $this->global_roles = $rbacreview->getGlobalRoles();
56 $this->valid_roles = $rbacreview->getParentRoleIds($this->object->getRefId());
57 $this->assigned_valid_roles = $this->getAssignedValidRoles();
58 }
user()
Definition: user.php:4
This class provides processing control methods.

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

+ Here is the call graph for this function:

Member Function Documentation

◆ accessPermissionsTable()

ilObjectPermissionStatusGUI::accessPermissionsTable ( )

Access Permissions Table.

Returns
string HTML

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

153 {
154 include_once("./Services/AccessControl/classes/class.ilAccessPermissionsStatusTableGUI.php");
155
156 $table = new ilAccessPermissionsStatusTableGUI($this, "perminfo");
157
158 $table->setData($this->getAccessPermissionTableData());
159 $table->setTitle($this->lng->txt("info_access_permissions"));
160
161 return $table->getHTML();
162 }
Table for Acces Permissons in Permission > Permission of User.
getAccessPermissionTableData()
Access Permissions Table Data.
if(empty($password)) $table
Definition: pwgen.php:24

References $table, and getAccessPermissionTableData().

Referenced by perminfo().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ accessStatusInfo()

ilObjectPermissionStatusGUI::accessStatusInfo ( )

Access- and Statusinformation Info.

Returns
string HTML

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

133 {
134 include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
135
136 $info = new ilInfoScreenGUI(new stdClass());
137 $info->setFormAction($this->ilCtrl->getFormAction($this));
138
139 $info->addSection($this->lng->txt("info_access_and_status_info"));
140
141 foreach ($this->getAccessStatusInfoData() as $data) {
142 $info->addProperty($data[0], $data[1]);
143 }
144
145 return $info->getHTML();
146 }
getFormAction( $a_gui_obj, $a_fallback_cmd="", $a_anchor="", $a_asynch=false, $xml_style=true)
Get form action url for gui class object.
Class ilInfoScreenGUI.
$info
Definition: index.php:5

References $data, $info, getAccessStatusInfoData(), and ilCtrl\getFormAction().

Referenced by perminfo().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addToolbar()

ilObjectPermissionStatusGUI::addToolbar ( )

Creates Toolbar entries.

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

106 {
107 global $ilToolbar;
108
109 $ilToolbar->setFormAction($this->ilCtrl->getFormAction($this, "perminfo"));
110
111 $ilToolbar->addText($this->lng->txt('user'));
112
113 include_once("./Services/Form/classes/class.ilTextInputGUI.php");
114
115 $login = new ilTextInputGUI($this->lng->txt("username"), "user_login");
116 $login->setDataSource($this->ilCtrl->getLinkTargetByClass(array(get_class($this),
117 'ilRepositorySearchGUI'), 'doUserAutoComplete', '', true));
118 $login->setSize(15);
119 $login->setValue($this->user->getLogin());
120
121 $ilToolbar->addInputItem($login);
122
123 $ilToolbar->addFormButton($this->lng->txt("info_change_user_view"), "perminfo");
124
125 //$ilToolbar->addText($lng->txt("info_enter_login_or_id"));
126 }
getLinkTargetByClass( $a_class, $a_cmd="", $a_anchor="", $a_asynch=false, $xml_style=true)
Get link target for command using gui class name.
This class represents a text property in a property form.

References ilCtrl\getFormAction(), ilCtrl\getLinkTargetByClass(), and user().

Referenced by perminfo().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ availableRolesTable()

ilObjectPermissionStatusGUI::availableRolesTable ( )

Available Roles Table.

Returns
string HTML

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

169 {
170 include_once("./Services/AccessControl/classes/class.ilAvailableRolesStatusTableGUI.php");
171
172 $table = new ilAvailableRolesStatusTableGUI($this, "perminfo");
173
174 $table->setData($this->getAvailableRolesTableData());
175 $table->setTitle($this->lng->txt("info_available_roles"));
176
177 return $table->getHTML();
178 }
Table for Available Roles in Permission > Permission of User.
getAvailableRolesTableData()
Available Roles Table Data.

References $table, and getAvailableRolesTableData().

Referenced by perminfo().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilObjectPermissionStatusGUI::executeCommand ( )

execute command

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

64 {
65 global $ilCtrl;
66
67 // determine next class in the call structure
68 $next_class = $this->ilCtrl->getNextClass($this);
69
70 switch ($next_class) {
71 case 'ilrepositorysearchgui':
72 include_once('./Services/Search/classes/class.ilRepositorySearchGUI.php');
73 $rep_search = new ilRepositorySearchGUI();
74 $this->ilCtrl->setReturn($this, 'perminfo');
75 $this->ilCtrl->forwardCommand($rep_search);
76 break;
77
78 default:
79 $cmd = $this->ilCtrl->getCmd();
80 $this->$cmd();
81 break;
82 }
83 }
getCmd($a_default_cmd="", $a_safe_commands="")
Determines current get/post command.
setReturn($a_gui_obj, $a_cmd)
Set return command.
getNextClass($a_gui_class=null)
Get next class in the control path from the current class to the target command class.
forwardCommand($a_gui_object)
Forward flow of control to next gui class this invokes the executeCommand() method of the gui object ...

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

+ Here is the call graph for this function:

◆ getAccessPermissionTableData()

ilObjectPermissionStatusGUI::getAccessPermissionTableData ( )

Access Permissions Table Data.

Returns
array

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

347 {
348 global $ilAccess,$ilObjDataCache,$objDefinition;
349
350 // get all possible operation of current object
351 $ops_list = ilRbacReview::_getOperationList($this->object->getType());
352
353 $counter = 0;
354 $result_set = array();
355
356 // check permissions of user
357 foreach ($ops_list as $ops) {
358 $access = $ilAccess->doRBACCheck($ops['operation'], "info", $this->object->getRefId(), $this->user->getId(), $this->object->getType());
359
360 $result_set[$counter]["img"] = $access ? self::IMG_OK : self::IMG_NOT_OK;
361
362 if (substr($ops['operation'], 0, 7) == "create_" &&
363 $objDefinition->isPlugin(substr($ops['operation'], 7))) {
364 $result_set[$counter]["operation"] = ilObjectPlugin::lookupTxtById(
365 substr($ops['operation'], 7),
366 'rbac_' . $ops['operation']
367 );
368 } elseif ($objDefinition->isPlugin($this->object->getType())) {
369 $result_set[$counter]["operation"] = ilObjectPlugin::lookupTxtById(
370 $this->object->getType(),
371 $this->object->getType() . "_" . $ops['operation']
372 );
373 } elseif (substr($ops['operation'], 0, 7) == 'create_') {
374 $result_set[$counter]["operation"] = $this->lng->txt('rbac_' . $ops['operation']);
375 } else {
376 $result_set[$counter]["operation"] = $this->lng->txt($this->object->getType() . "_" . $ops['operation']);
377 }
378
379 $list_role = [];
380
381 // Check ownership
382 if ($this->user->getId() == $ilObjDataCache->lookupOwner($this->object->getId())) {
383 if (
384 (substr($ops['operation'], 0, 7) != 'create_') and
385 ($ops['operation'] != 'edit_permission') and
386 ($ops['operation'] != 'edit_leanring_progress')
387 ) {
388 $list_role[] = $this->lng->txt('info_owner_of_object');
389 }
390 }
391 // get operations on object for each assigned role to user
392 foreach ($this->getAssignedValidRoles() as $role) {
393 if (in_array($ops['ops_id'], $role['ops'])) {
394 $list_role[] = $role['translation'];
395 }
396 }
397
398 if (empty($list_role)) {
399 $list_role[] = $this->lng->txt('none');
400 }
401
402
403 $result_set[$counter]["role_ownership"] = $list_role;
404
405 ++$counter;
406 }
407
408 return $result_set;
409 }
static lookupTxtById($plugin_id, $lang_var)
static _getOperationList($a_type=null)
get operation list by object type @access public @access static
$counter

References $counter, ilRbacReview\_getOperationList(), getAssignedValidRoles(), IMG_NOT_OK, IMG_OK, ilObjectPlugin\lookupTxtById(), and user().

Referenced by accessPermissionsTable().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAccessStatusInfoData()

ilObjectPermissionStatusGUI::getAccessStatusInfoData ( )

Access Status Info Data.

Returns
array

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

270 {
271 global $ilAccess;
272 $infos = array();
273
274 $result_set[0][] = $this->lng->txt("info_view_of_user");
275 $result_set[0][] = $this->user->getFullname() . " (#" . $this->user->getId() . ")";
276
277 $assigned_valid_roles = array();
278
279 foreach ($this->getAssignedValidRoles() as $role) {
280 $assigned_valid_roles[] = $role["translation"];
281 }
282
283 $roles_str = implode(", ", $assigned_valid_roles);
284
285 $result_set[1][] = $this->lng->txt("roles");
286 $result_set[1][] = $roles_str;
287
288 $result_set[2][] = $this->lng->txt("status");
289
290 $ilAccess->clear();
291 $ilAccess->checkAccessOfUser(
292 $this->user->getId(),
293 'read',
294 '',
295 $this->object->getRefId(),
296 $this->object->getType(),
297 $this->object->getId()
298 );
299
300 $infos = array_merge($infos, $ilAccess->getInfo());
301
302 $cmds = $this->getCommands($this->object->getType());
303
304 foreach ($cmds as $cmd) {
305 $ilAccess->clear();
306 $ilAccess->doStatusCheck($cmd['permission'], $cmd['cmd'], $this->object->getRefId(), $this->user->getId(), $this->object->getId(), $this->object->getType());
307 $infos = array_merge($infos, $ilAccess->getInfo());
308 }
309
310 $alert = "il_ItemAlertProperty";
311 $okay = "il_ItemOkayProperty";
312 $text = "";
313
314 if (!$infos) {
315 $text = "<span class=\"" . $okay . "\">" . $this->lng->txt("access") . "</span><br/> ";
316 } else {
317 foreach ($infos as $info) {
318 switch ($info['type']) {
320 $text .= "<span class=\"" . $okay . "\">" . $info['text'] . "</span><br/> ";
321 break;
322
325 $obj = $factory->getInstanceByRefId($info['data']);
326 $text .= "<span class=\"" . $alert . "\">" . $info['text'] . " (" . $this->lng->txt("obj_" . $obj->getType()) . " #" . $obj->getId() . ": " . $obj->getTitle() . ")</span><br/> ";
327 break;
328
329 default:
330 $text .= "<span class=\"" . $alert . "\">" . $info['text'] . "</span><br/> ";
331 break;
332
333 }
334 }
335 }
336
337 $result_set[2][] = $text;
338
339 return $result_set;
340 }
$factory
Definition: metadata.php:47
const IL_STATUS_MESSAGE
const IL_NO_PARENT_ACCESS
Class ilObjectFactory.
$text
Definition: errorreport.php:18

References $assigned_valid_roles, $factory, $info, $text, getAssignedValidRoles(), getCommands(), IL_NO_PARENT_ACCESS, IL_STATUS_MESSAGE, and user().

Referenced by accessStatusInfo().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAssignedValidRoles()

ilObjectPermissionStatusGUI::getAssignedValidRoles ( )

get Assigned Valid Roles

Returns
array

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

185 {
186 include_once('./Services/AccessControl/classes/class.ilObjRole.php');
187 $assigned_valid_roles = array();
188
189 foreach ($this->valid_roles as $role) {
190 if (in_array($role['obj_id'], $this->user_roles)) {
191 if ($role["obj_id"] == SYSTEM_ROLE_ID) {
192 // get all possible operation of current object
193 $ops_list = ilRbacReview::_getOperationList($this->object->getType());
194
195 foreach ($ops_list as $ops_data) {
196 $ops[] = (int) $ops_data['ops_id'];
197 }
198
199 $role['ops'] = $ops;
200 } else {
201 $role['ops'] = $this->rbacreview->getRoleOperationsOnObject($role["obj_id"], $this->object->getRefId());
202 }
203
204 include_once('./Services/AccessControl/classes/class.ilObjRole.php');
205 $role['translation'] = str_replace(" ", "&nbsp;", ilObjRole::_getTranslation($role["title"]));
206 $assigned_valid_roles[] = $role;
207 }
208 }
209
210 $this->assigned_valid_roles = $assigned_valid_roles;
211
213 }
static _getTranslation($a_role_title)

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

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAvailableRolesTableData()

ilObjectPermissionStatusGUI::getAvailableRolesTableData ( )

Available Roles Table Data.

Returns
array

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

416 {
417 global $tree;
418
419 include_once('./Services/AccessControl/classes/class.ilObjRole.php');
420
421 $path = array_reverse($tree->getPathId($this->object->getRefId()));
422
423 include_once('./Services/AccessControl/classes/class.ilObjRole.php');
424 $counter = 0;
425
426 foreach ($this->valid_roles as $role) {
427 $result_set[$counter]["img"] = in_array($role['obj_id'], $this->user_roles) ? self::IMG_OK : self::IMG_NOT_OK;
428
429 if (is_subclass_of($this->object, ilObjectPlugin::class) && $role["parent"] == $this->object->getRefId()) {
430 $result_set[$counter][] = ilObjectPlugin::lookupTxtById($this->object->getType(), ilObjRole::_removeObjectId($role["title"]));
431 } else {
432 $result_set[$counter][] = str_replace(" ", "&nbsp;", ilObjRole::_getTranslation($role["title"]));
433 }
434
435 $result_set[$counter]["role"] = str_replace(" ", "&nbsp;", ilObjRole::_getTranslation($role["title"]));
436
437 if ($role['role_type'] != "linked") {
438 $result_set[$counter]["effective_from"] = "";
439 } else {
440 $rolfs = $this->rbacreview->getFoldersAssignedToRole($role["obj_id"]);
441
442 // ok, try to match the next rolf in path
443 foreach ($path as $node) {
444 if ($node == 1) {
445 break;
446 }
447
448
449 if (in_array($node, $rolfs)) {
450 $nodedata = $tree->getNodeData($node);
451 $result_set[$counter]["effective_from"] = $nodedata["title"];
452 $result_set[$counter]["effective_from_ref_id"] = $node;
453 break;
454 }
455 }
456 }
457
458 if (in_array($role['obj_id'], $this->global_roles)) {
459 $result_set[$counter]["original_position"] = $this->lng->txt("global");
460 $result_set[$counter]["original_position_ref_id"] = false;
461 } else {
462 $rolf = $this->rbacreview->getFoldersAssignedToRole($role["obj_id"], true);
463 $parent_node = $tree->getNodeData($rolf[0]);
464 $result_set[$counter]["original_position"] = $parent_node["title"];
465 $result_set[$counter]["original_position_ref_id"] = $parent_node["ref_id"];
466 }
467
468 ++$counter;
469 }
470
471 return $result_set;
472 }
static _removeObjectId($a_role_title)

References $counter, $path, ilObjRole\_getTranslation(), ilObjRole\_removeObjectId(), IMG_NOT_OK, IMG_OK, and ilObjectPlugin\lookupTxtById().

Referenced by availableRolesTable().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCommands()

ilObjectPermissionStatusGUI::getCommands (   $a_type)

get Commands

Parameters
$a_typestring
Returns
array

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

221 {
222 global $objDefinition;
223
224 $class = $objDefinition->getClassName($a_type);
225 $location = $objDefinition->getLocation($a_type);
226 $full_class = "ilObj" . $class . "Access";
227 include_once($location . "/class." . $full_class . ".php");
228
229 $cmds = call_user_func(array($full_class, "_getCommands"));
230
231 array_push($cmds, array('permission' => 'visible','cmd' => 'info'));
232
233 return $cmds;
234 }
$location
Definition: buildRTE.php:44
$a_type
Definition: workflow.php:92

References $a_type, and $location.

Referenced by getAccessStatusInfoData().

+ Here is the caller graph for this function:

◆ getUser()

ilObjectPermissionStatusGUI::getUser ( )

ilUser

Returns
ilObjUser|object

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

241 {
242 global $ilUser;
243
244 if (!isset($_POST['user_login'])) {
245 $user =&$ilUser;
246 } else {
247 include_once('Services/User/classes/class.ilObjUser.php');
248 $user_id = ilObjUser::_lookupId($_POST['user_login']);
249
251 $user = $factory->getInstanceByObjId($user_id, false);
252
253
254 if ($user === false or $user->getType() != 'usr') {
255 $user =&$ilUser;
256 ilUtil::sendFailure($this->lng->txt('info_err_user_not_exist'));
257 } else {
258 ilUtil::sendInfo($this->lng->txt('info_user_view_changed'));
259 }
260 }
261
262 return $user;
263 }
$_POST["username"]
static _lookupId($a_user_str)
Lookup id by login.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$ilUser
Definition: imgupload.php:18

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

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ perminfo()

ilObjectPermissionStatusGUI::perminfo ( )

cmd function

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

89 {
90 $tpl = new ilTemplate("tpl.info_layout.html", false, false, "Services/AccessControl");
91
92 $tpl->setVariable("INFO_SUMMARY", $this->accessStatusInfo());
93 $tpl->setVariable("INFO_PERMISSIONS", $this->accessPermissionsTable());
94 $tpl->setVariable("INFO_ROLES", $this->availableRolesTable());
95 $tpl->setVariable("INFO_REMARK_INTERRUPTED", $this->lng->txt('info_remark_interrupted'));
96
97 $this->tpl->setVariable("ADM_CONTENT", $tpl->get());
98
99 $this->addToolbar();
100 }
accessStatusInfo()
Access- and Statusinformation Info.
accessPermissionsTable()
Access Permissions Table.
special template class to simplify handling of ITX/PEAR

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

+ Here is the call graph for this function:

Field Documentation

◆ $assigned_valid_roles

ilObjectPermissionStatusGUI::$assigned_valid_roles

◆ $global_roles

ilObjectPermissionStatusGUI::$global_roles

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

◆ $ilCtrl

ilObjectPermissionStatusGUI::$ilCtrl

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

Referenced by __construct(), and executeCommand().

◆ $lng

ilObjectPermissionStatusGUI::$lng

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

Referenced by __construct().

◆ $object

ilObjectPermissionStatusGUI::$object

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

◆ $rbacreview

ilObjectPermissionStatusGUI::$rbacreview

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

Referenced by __construct().

◆ $tpl

ilObjectPermissionStatusGUI::$tpl

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

Referenced by __construct(), and perminfo().

◆ $user

ilObjectPermissionStatusGUI::$user

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

Referenced by getUser().

◆ $user_roles

ilObjectPermissionStatusGUI::$user_roles

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

◆ $valid_roles

ilObjectPermissionStatusGUI::$valid_roles

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

◆ IMG_NOT_OK

const ilObjectPermissionStatusGUI::IMG_NOT_OK = 1

◆ IMG_OK


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