ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
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="")
 {} 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...
 

Static Public Member Functions

static _getCommands ()
 {} More...
 
static _checkGoto ($a_target)
 {} 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 = "" 
)

{}

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

References $GLOBALS.

62  {
63  if ($a_user_id == '') {
64  $a_user_id = $GLOBALS['DIC']->user()->getId();
65  }
66 
67  return self::checkRoomAccess($a_permission, $a_ref_id, $a_obj_id, $a_user_id);
68  }
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64

◆ _checkGoto()

static ilObjChatroomAccess::_checkGoto (   $a_target)
static

{}

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

References ilChatroom\checkUserPermissions().

39  {
40  if (is_string($a_target)) {
41  $t_arr = explode("_", $a_target);
42 
43  if (count($t_arr) < 2 || $t_arr[0] != 'chtr' || ((int) $t_arr[1]) <= 0) {
44  return false;
45  }
46 
47  if (
48  ilChatroom::checkUserPermissions('visible', $t_arr[1], false) ||
49  ilChatroom::checkUserPermissions('read', $t_arr[1], false)
50  ) {
51  return true;
52  }
53  }
54 
55  return false;
56  }
static checkUserPermissions($permissions, $ref_id, $send_info=true)
Checks user permissions by given array and ref_id.
+ Here is the call graph for this function:

◆ _getCommands()

static ilObjChatroomAccess::_getCommands ( )
static

{}

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

Referenced by ilObjChatroomListGUI\init().

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  }
+ Here is the caller graph for this function:

◆ canBeDelivered()

ilObjChatroomAccess::canBeDelivered ( ilWACPath  $ilWACPath)

Parameters
ilWACPath$ilWACPath
Returns
bool

Implements ilWACCheckingClass.

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

References ilWACPath\getPath().

163  {
164  if (preg_match("/chatroom\\/smilies\\//ui", $ilWACPath->getPath())) {
165  return true;
166  }
167 
168  return false;
169  }
+ 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 71 of file class.ilObjChatroomAccess.php.

References $GLOBALS, IL_NO_OBJECT_ACCESS, and language().

72  {
73  if (self::$chat_enabled === null) {
74  $chatSetting = new ilSetting('chatroom');
75  self::$chat_enabled = (boolean) $chatSetting->get('chat_enabled');
76  }
77 
78  if ($GLOBALS['DIC']->rbac()->system()->checkAccessOfUser($a_user_id, 'write', $a_ref_id)) {
79  return true;
80  }
81 
82  switch ($a_permission) {
83  case 'visible':
84  $visible = null;
85 
86  $active = self::isActivated($a_ref_id, $a_obj_id, $visible);
87  $hasWriteAccess = $GLOBALS['DIC']->rbac()->system()->checkAccessOfUser($a_user_id, 'write', $a_ref_id);
88 
89  if (!$active) {
90  $GLOBALS['DIC']->access()->addInfoItem(IL_NO_OBJECT_ACCESS, $GLOBALS['DIC']->language()->txt('offline'));
91  }
92 
93  if (!$hasWriteAccess && !$active && !$visible) {
94  return false;
95  }
96  break;
97 
98  case 'read':
99  $hasWriteAccess = $GLOBALS['DIC']->rbac()->system()->checkAccessOfUser($a_user_id, 'write', $a_ref_id);
100  if ($hasWriteAccess) {
101  return true;
102  }
103 
104  $active = self::isActivated($a_ref_id, $a_obj_id);
105  if (!$active) {
106  $GLOBALS['DIC']->access()->addInfoItem(IL_NO_OBJECT_ACCESS, $GLOBALS['DIC']->language()->txt('offline'));
107  return false;
108  }
109  break;
110  }
111 
112  return self::$chat_enabled;
113  }
const IL_NO_OBJECT_ACCESS
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
language()
Definition: language.php:2
+ Here is the call 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 121 of file class.ilObjChatroomAccess.php.

References $objId, $refId, ilObjectActivation\getItem(), and ilObjectActivation\TIMINGS_ACTIVATION.

Referenced by ilChatroom\checkPermissions().

122  {
123  if (!self::lookupOnline($objId)) {
124  $a_visible_flag = false;
125  return false;
126  }
127 
128  $a_visible_flag = true;
129 
130  require_once 'Services/Object/classes/class.ilObjectActivation.php';
132  switch ($item['timing_type']) {
134  if (time() < $item['timing_start'] || time() > $item['timing_end']) {
135  $a_visible_flag = $item['visible'];
136  return false;
137  }
138 
139  // no break
140  default:
141  return true;
142  }
143  }
static getItem($a_ref_id)
Get item data.
$objId
Definition: xapitoken.php:39
$refId
Definition: xapitoken.php:40
+ 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 149 of file class.ilObjChatroomAccess.php.

References $DIC, and $res.

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

Field Documentation

◆ $chat_enabled

ilObjChatroomAccess::$chat_enabled = null
staticprivate

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


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