ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilObjChatroomAccess.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2012 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4require_once 'Services/Object/classes/class.ilObjectAccess.php';
5require_once 'Services/WebAccessChecker/interfaces/interface.ilWACCheckingClass.php';
6
14{
18 private static $chat_enabled = null;
19
23 public static function _getCommands()
24 {
25 $commands = array();
26 $commands[] = array("permission" => "read", "cmd" => "view", "lang_var" => "enter", "default" => true);
27 $commands[] = array("permission" => "write", "cmd" => "settings-general", "lang_var" => "settings");
28
29 // alex 3 Oct 2012: this leads to a blank screen, i guess it is a copy/paste bug from files
30 //$commands[] = array("permission" => "write", "cmd" => "versions", "lang_var" => "versions");
31
32 return $commands;
33 }
34
38 public static function _checkGoto($a_target)
39 {
43 global $rbacsystem;
44
45 if(is_string($a_target))
46 {
47 $t_arr = explode("_", $a_target);
48
49 if(count($t_arr) < 2 || $t_arr[0] != "chtr" || ((int)$t_arr[1]) <= 0)
50 {
51 return false;
52 }
53
54 if($rbacsystem->checkAccess("read", $t_arr[1]))
55 {
56 return true;
57 }
58 }
59
60 return false;
61 }
62
66 function _checkAccess($a_cmd, $a_permission, $a_ref_id, $a_obj_id, $a_user_id = "")
67 {
72 global $ilUser, $rbacsystem;
73
74 if(self::$chat_enabled === null)
75 {
76 $chatSetting = new ilSetting('chatroom');
77 self::$chat_enabled = (boolean)$chatSetting->get('chat_enabled');
78 }
79
80 if($a_user_id == "")
81 {
82 $a_user_id = $ilUser->getId();
83 }
84
85 if($rbacsystem->checkAccessOfUser($a_user_id, 'write', $a_ref_id))
86 {
87 return true;
88 }
89
91 }
92
96 public function canBeDelivered(ilWACPath $ilWACPath)
97 {
98 if(preg_match("/chatroom\\/smilies\\//ui", $ilWACPath->getPath()))
99 {
100 return true;
101 }
102
103 return false;
104 }
105}
An exception for terminatinating execution or to throw for unit testing.
Access class for chatroom objects.
canBeDelivered(ilWACPath $ilWACPath)
bool
static _getCommands()
{get commandsthis method returns an array of all possible commands/permission combinationsexample: ...
Class ilObjectAccess.
static _checkGoto($a_target)
check whether goto script will succeed
_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...
ILIAS Setting Class.
Class ilWACPath.
Class ilWACCheckingClass.
$ilUser
Definition: imgupload.php:18