ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 include_once("./Services/Object/classes/class.ilObjectAccess.php");
6 
16 {
17 
30  public function _getCommands()
31  {
32  $commands = array();
33  $commands[] = array("permission" => "read", "cmd" => "view", "lang_var" => "enter", "default" => true);
34  $commands[] = array("permission" => "write", "cmd" => "settings-general", "lang_var" => "settings");
35 
36  // alex 3 Oct 2012: this leads to a blank screen, i guess it is a copy/paste bug from files
37  //$commands[] = array("permission" => "write", "cmd" => "versions", "lang_var" => "versions");
38 
39  return $commands;
40  }
41 
50  public function _checkGoto($a_target)
51  {
55  global $rbacsystem;
56 
57  $t_arr = explode("_", $a_target);
58 
59  if ($t_arr[0] != "chtr" || ((int) $t_arr[1]) <= 0)
60  {
61  return false;
62  }
63 
64  if ($rbacsystem->checkAccess("visible", $t_arr[1]))
65  {
66  return true;
67  }
68 
69  return false;
70  }
71 
72  private static $chat_enabled = null;
73 
74  function _checkAccess($a_cmd, $a_permission, $a_ref_id, $a_obj_id, $a_user_id = "")
75  {
76  global $ilUser, $rbacsystem;
77 
78  if (self::$chat_enabled === null) {
79  $chatSetting = new ilSetting('chatroom');
80  self::$chat_enabled = (boolean) $chatSetting->get('chat_enabled');
81  }
82 
83  if ($a_user_id == "")
84  {
85  $a_user_id = $ilUser->getId();
86  }
87 
88  if ($rbacsystem->checkAccessOfUser($a_user_id, 'write', $a_ref_id)) {
89  return true;
90  }
91  return self::$chat_enabled;
92  }
93 
94 }
95 
96 ?>