ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilObjGroupReferenceAccess.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2016 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once("./Services/ContainerReference/classes/class.ilContainerReferenceAccess.php");
5 
14 {
32  public function _checkAccess($a_cmd, $a_permission, $a_ref_id, $a_obj_id, $a_user_id = "")
33  {
34  global $DIC;
35 
36  $ilAccess = $DIC['ilAccess'];
37 
38  switch ($a_permission) {
39  case 'visible':
40  case 'read':
41  include_once './Modules/GroupReference/classes/class.ilObjGroupReference.php';
42  $target_ref_id = ilObjGroupReference::_lookupTargetRefId($a_obj_id);
43 
44  if (!$ilAccess->checkAccessOfUser($a_user_id, $a_permission, $a_cmd, $target_ref_id)) {
45  return false;
46  }
47  break;
48  }
49 
50  return true;
51  }
52 
73  public static function _getCommands($a_ref_id = 0)
74  {
75  global $DIC;
76 
77  $ilAccess = $DIC['ilAccess'];
78 
79  if ($ilAccess->checkAccess('write', '', $a_ref_id)) {
80  // Only local (reference specific commands)
81  $commands = array(
82  array("permission" => "visible", "cmd" => "", "lang_var" => "show","default" => true),
83  array("permission" => "write", "cmd" => "editReference", "lang_var" => "edit")
84  );
85  } else {
86  include_once('./Modules/Group/classes/class.ilObjGroupAccess.php');
87  $commands = ilObjGroupAccess::_getCommands();
88  }
89  return $commands;
90  }
91 }
global $DIC
Definition: saml.php:7
static _getCommands($a_ref_id=0)
get commands
static _getCommands()
get commands
static _lookupTargetRefId($a_obj_id)
Lookup target ref_id.
_checkAccess($a_cmd, $a_permission, $a_ref_id, $a_obj_id, $a_user_id="")
Checks wether a user may invoke a command or not (this method is called by ilAccessHandler::checkAcce...