ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilObjChatroomAccess.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 require_once 'Services/Object/classes/class.ilObjectAccess.php';
6 require_once 'Services/WebAccessChecker/interfaces/interface.ilWACCheckingClass.php';
7 
17 {
18 
31  public function _getCommands()
32  {
33  $commands = array();
34  $commands[] = array("permission" => "read", "cmd" => "view", "lang_var" => "enter", "default" => true);
35  $commands[] = array("permission" => "write", "cmd" => "settings-general", "lang_var" => "settings");
36 
37  // alex 3 Oct 2012: this leads to a blank screen, i guess it is a copy/paste bug from files
38  //$commands[] = array("permission" => "write", "cmd" => "versions", "lang_var" => "versions");
39 
40  return $commands;
41  }
42 
51  public function _checkGoto($a_target)
52  {
56  global $rbacsystem;
57 
58  $t_arr = explode("_", $a_target);
59 
60  if ($t_arr[0] != "chtr" || ((int) $t_arr[1]) <= 0)
61  {
62  return false;
63  }
64 
65  if ($rbacsystem->checkAccess("read", $t_arr[1]))
66  {
67  return true;
68  }
69 
70  return false;
71  }
72 
73  private static $chat_enabled = null;
74 
75  function _checkAccess($a_cmd, $a_permission, $a_ref_id, $a_obj_id, $a_user_id = "")
76  {
77  global $ilUser, $rbacsystem;
78 
79  if (self::$chat_enabled === null) {
80  $chatSetting = new ilSetting('chatroom');
81  self::$chat_enabled = (boolean) $chatSetting->get('chat_enabled');
82  }
83 
84  if ($a_user_id == "")
85  {
86  $a_user_id = $ilUser->getId();
87  }
88 
89  if ($rbacsystem->checkAccessOfUser($a_user_id, 'write', $a_ref_id)) {
90  return true;
91  }
92  return self::$chat_enabled;
93  }
94 
98  public function canBeDelivered(ilWACPath $ilWACPath)
99  {
100  if(preg_match("/chatroom\\/smilies\\//ui", $ilWACPath->getPath()))
101  {
102  return true;
103  }
104 
105  return false;
106  }
107 }
108 
109 ?>
ILIAS Setting Class.
_checkGoto($a_target)
check whether goto script will succeed
_checkAccess($a_cmd, $a_permission, $a_ref_id, $a_obj_id, $a_user_id="")
Class ilWACPath.
Access class for chatroom objects.
canBeDelivered(ilWACPath $ilWACPath)
bool
Class ilWACCheckingClass.
global $ilUser
Definition: imgupload.php:15
Class ilObjectAccess.
_getCommands()
This method returns an array of all possible commands/permission combinations.