ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilObjBookingPoolAccess.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2012 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 
6 include_once("./Services/Object/classes/class.ilObjectAccess.php");
7 require_once('./Services/WebAccessChecker/interfaces/interface.ilWACCheckingClass.php');
8 
19 {
23  protected $user;
24 
28  protected $rbacsystem;
29 
30 
34  public function __construct()
35  {
36  global $DIC;
37 
38  $this->user = $DIC->user();
39  $this->rbacsystem = $DIC->rbac()->system();
40  }
41 
42 
55  public static function _getCommands()
56  {
57  $commands = array();
58  $commands[] = array("permission" => "read", "cmd" => "render", "lang_var" => "show", "default" => true);
59  $commands[] = array("permission" => "write", "cmd" => "render", "lang_var" => "edit_content");
60  $commands[] = array("permission" => "write", "cmd" => "edit", "lang_var" => "settings");
61 
62  return $commands;
63  }
64 
68  public static function _checkGoto($a_target)
69  {
70  global $DIC;
71 
72  $ilAccess = $DIC->access();
73 
74  $t_arr = explode("_", $a_target);
75 
76  if ($t_arr[0] != "book" || ((int) $t_arr[1]) <= 0) {
77  return false;
78  }
79 
80  if ($ilAccess->checkAccess("read", "", $t_arr[1])) {
81  return true;
82  }
83  return false;
84  }
85 
86  public function _checkAccess($a_cmd, $a_permission, $a_ref_id, $a_obj_id, $a_user_id = "")
87  {
90 
91  if ($a_user_id == "") {
92  $a_user_id = $ilUser->getId();
93  }
94 
95  // add no access info item and return false if access is not granted
96  // $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $a_text, $a_data = "");
97  //
98  // for all RBAC checks use checkAccessOfUser instead the normal checkAccess-method:
99  // $rbacsystem->checkAccessOfUser($a_user_id, $a_permission, $a_ref_id)
100 
101  //TODO refactor this: first check if the object is online and then the permissions.
102  #22653
103  if (($a_permission == "visible" || $a_permission == "read") && !$rbacsystem->checkAccessOfUser($a_user_id, 'write', $a_ref_id)) {
104  include_once "Modules/BookingManager/classes/class.ilObjBookingPool.php";
105  $pool = new ilObjBookingPool($a_ref_id);
106  if ($pool->isOffline()) {
107  return false;
108  }
109  }
110 
111  return true;
112  }
113 
119  public function canBeDelivered(ilWACPath $ilWACPath)
120  {
121 
122  // we return always false, since the files in the file/ and post/ directoies
123  // are server by php (they could/should be moved to the data dir outside of the web doc root)
124  return false;
125  }
126 }
static _checkGoto($a_target)
check whether goto script will succeed
global $DIC
Definition: saml.php:7
Class ilObjBookingPool.
Class ilWACPath.
user()
Definition: user.php:4
$ilUser
Definition: imgupload.php:18
Class ilWACCheckingClass.
_checkAccess($a_cmd, $a_permission, $a_ref_id, $a_obj_id, $a_user_id="")
Class ilObjectAccess.
Class ilObjBookingPoolAccess.