ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilObjChatroomAccess Class Reference

Access class for chatroom objects. More...

+ Inheritance diagram for ilObjChatroomAccess:
+ Collaboration diagram for ilObjChatroomAccess:

Public Member Functions

 _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::checkAccess)Please do not check any preconditions handled by ilConditionHandler here. Also don't do any RBAC checks.
Parameters
string$a_cmdcommand (not permission!)
string$a_permissionpermission
int$a_ref_idreference id
int$a_obj_idobject id
int$a_user_iduser id (if not provided, current user is taken)
Returns
boolean true, if everything is ok
} More...
 
 canBeDelivered (ilWACPath $ilWACPath)
 
Parameters
ilWACPath$ilWACPath
Returns
bool
More...
 
- Public Member Functions inherited from ilObjectAccess
 _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::checkAccess) More...
 
 _checkCondition ($a_obj_id, $a_operator, $a_value, $a_usr_id)
 check condition More...
 
 canBeDelivered (ilWACPath $ilWACPath)
 
Parameters
ilWACPath$ilWACPath
Returns
bool
More...
 
 canBeDelivered (ilWACPath $ilWACPath)
 

Static Public Member Functions

static _getCommands ()
 {get commandsthis method returns an array of all possible commands/permission combinationsexample: $commands = array ( array("permission" => "read", "cmd" => "view", "lang_var" => "show"), array("permission" => "write", "cmd" => "edit", "lang_var" => "edit"), );} More...
 
static _checkGoto ($a_target)
 {check whether goto script will succeed} More...
 
static checkRoomAccess ($a_permission, $a_ref_id, $a_obj_id, $a_user_id)
 
static isActivated ($refId, $objId, &$a_visible_flag=null)
 
static lookupOnline ($a_obj_id)
 
- Static Public Member Functions inherited from ilObjectAccess
static _getCommands ()
 get commands More...
 
static _checkGoto ($a_target)
 check whether goto script will succeed More...
 
static _isOffline ($a_obj_id)
 Type-specific implementation of general status, has to be overwritten if object type does not support centralized offline handling. More...
 
static _preloadData ($a_obj_ids, $a_ref_ids)
 Preload data. More...
 

Static Private Attributes

static $chat_enabled = null
 

Detailed Description

Access class for chatroom objects.

Author
Jan Posselt <jposselt at databay.de>
Version
$Id$

Definition at line 13 of file class.ilObjChatroomAccess.php.

Member Function Documentation

◆ _checkAccess()

ilObjChatroomAccess::_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::checkAccess)Please do not check any preconditions handled by ilConditionHandler here. Also don't do any RBAC checks.

Parameters
string$a_cmdcommand (not permission!)
string$a_permissionpermission
int$a_ref_idreference id
int$a_obj_idobject id
int$a_user_iduser id (if not provided, current user is taken)
Returns
boolean true, if everything is ok
}

Reimplemented from ilObjectAccess.

Definition at line 60 of file class.ilObjChatroomAccess.php.

61 {
62 if ($a_user_id == '') {
63 $a_user_id = $GLOBALS['DIC']->user()->getId();
64 }
65
66 return self::checkRoomAccess($a_permission, $a_ref_id, $a_obj_id, $a_user_id);
67 }
static checkRoomAccess($a_permission, $a_ref_id, $a_obj_id, $a_user_id)
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.

References $GLOBALS, and checkRoomAccess().

+ Here is the call graph for this function:

◆ _checkGoto()

static ilObjChatroomAccess::_checkGoto (   $a_target)
static

{check whether goto script will succeed}

Reimplemented from ilObjectAccess.

Definition at line 38 of file class.ilObjChatroomAccess.php.

39 {
40 global $DIC;
41
42 if (is_string($a_target)) {
43 $t_arr = explode("_", $a_target);
44
45 if (count($t_arr) < 2 || $t_arr[0] != "chtr" || ((int) $t_arr[1]) <= 0) {
46 return false;
47 }
48
49 if ($DIC->rbac()->system()->checkAccess("read", $t_arr[1])) {
50 return true;
51 }
52 }
53
54 return false;
55 }
global $DIC
Definition: saml.php:7

References $DIC.

◆ _getCommands()

static ilObjChatroomAccess::_getCommands ( )
static

{get commandsthis method returns an array of all possible commands/permission combinationsexample: $commands = array ( array("permission" => "read", "cmd" => "view", "lang_var" => "show"), array("permission" => "write", "cmd" => "edit", "lang_var" => "edit"), );}

Reimplemented from ilObjectAccess.

Definition at line 23 of file class.ilObjChatroomAccess.php.

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 }

Referenced by ilObjChatroomListGUI\init().

+ Here is the caller graph for this function:

◆ canBeDelivered()

ilObjChatroomAccess::canBeDelivered ( ilWACPath  $ilWACPath)

Parameters
ilWACPath$ilWACPath
Returns
bool

Reimplemented from ilObjectAccess.

Definition at line 161 of file class.ilObjChatroomAccess.php.

162 {
163 if (preg_match("/chatroom\\/smilies\\//ui", $ilWACPath->getPath())) {
164 return true;
165 }
166
167 return false;
168 }

References ilWACPath\getPath().

+ Here is the call graph for this function:

◆ checkRoomAccess()

static ilObjChatroomAccess::checkRoomAccess (   $a_permission,
  $a_ref_id,
  $a_obj_id,
  $a_user_id 
)
static

Definition at line 70 of file class.ilObjChatroomAccess.php.

71 {
72 if (self::$chat_enabled === null) {
73 $chatSetting = new ilSetting('chatroom');
74 self::$chat_enabled = (boolean) $chatSetting->get('chat_enabled');
75 }
76
77 if ($GLOBALS['DIC']->rbac()->system()->checkAccessOfUser($a_user_id, 'write', $a_ref_id)) {
78 return true;
79 }
80
81 switch ($a_permission) {
82 case 'visible':
83 $visible = null;
84
85 $active = self::isActivated($a_ref_id, $a_obj_id, $visible);
86 $hasWriteAccess = $GLOBALS['DIC']->rbac()->system()->checkAccessOfUser($a_user_id, 'write', $a_ref_id);
87
88 if (!$active) {
89 $GLOBALS['DIC']->access()->addInfoItem(IL_NO_OBJECT_ACCESS, $GLOBALS['DIC']->language()->txt('offline'));
90 }
91
92 if (!$hasWriteAccess && !$active && !$visible) {
93 return false;
94 }
95 break;
96
97 case 'read':
98 $hasWriteAccess = $GLOBALS['DIC']->rbac()->system()->checkAccessOfUser($a_user_id, 'write', $a_ref_id);
99 if ($hasWriteAccess) {
100 return true;
101 }
102
103 $active = self::isActivated($a_ref_id, $a_obj_id);
104 if (!$active) {
105 $GLOBALS['DIC']->access()->addInfoItem(IL_NO_OBJECT_ACCESS, $GLOBALS['DIC']->language()->txt('offline'));
106 return false;
107 }
108 break;
109 }
110
111 return self::$chat_enabled;
112 }
const IL_NO_OBJECT_ACCESS
static isActivated($refId, $objId, &$a_visible_flag=null)
ILIAS Setting Class.

References $chat_enabled, $GLOBALS, IL_NO_OBJECT_ACCESS, and isActivated().

Referenced by _checkAccess().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isActivated()

static ilObjChatroomAccess::isActivated (   $refId,
  $objId,
$a_visible_flag = null 
)
static
Parameters
int$refId
int$objId
null$a_visible_flag
Returns
bool

Definition at line 120 of file class.ilObjChatroomAccess.php.

121 {
122 if (!self::lookupOnline($objId)) {
123 $a_visible_flag = false;
124 return false;
125 }
126
127 $a_visible_flag = true;
128
129 require_once 'Services/Object/classes/class.ilObjectActivation.php';
130 $item = ilObjectActivation::getItem($refId);
131 switch ($item['timing_type']) {
133 if (time() < $item['timing_start'] || time() > $item['timing_end']) {
134 $a_visible_flag = $item['visible'];
135 return false;
136 }
137
138 // no break
139 default:
140 return true;
141 }
142 }
static getItem($a_ref_id)
Get item data.

References ilObjectActivation\getItem(), and ilObjectActivation\TIMINGS_ACTIVATION.

Referenced by ilChatroom\checkPermissions(), and checkRoomAccess().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lookupOnline()

static ilObjChatroomAccess::lookupOnline (   $a_obj_id)
static
Parameters
int$a_obj_id
Returns
bool

Definition at line 148 of file class.ilObjChatroomAccess.php.

149 {
150 global $DIC;
151
152 $res = $DIC->database()->query("SELECT online_status FROM chatroom_settings WHERE object_id = " . $DIC->database()->quote($a_obj_id, 'integer'));
153 $row = $DIC->database()->fetchAssoc($res);
154
155 return (bool) $row['online_status'];
156 }
$row
foreach($_POST as $key=> $value) $res

References $DIC, $res, and $row.

Field Documentation

◆ $chat_enabled

ilObjChatroomAccess::$chat_enabled = null
staticprivate

Definition at line 18 of file class.ilObjChatroomAccess.php.

Referenced by checkRoomAccess().


The documentation for this class was generated from the following file: