ILIAS  trunk Revision v11.0_alpha-1761-g6dbbfa7b760
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilObjChatroomAccess Class Reference

Access class for chatroom objects. More...

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

Public Member Functions

 _checkAccess (string $cmd, string $permission, int $ref_id, int $obj_id, ?int $user_id=null)
 
 canBeDelivered (ilWACPath $ilWACPath)
 
- Public Member Functions inherited from ilObjectAccess
 _checkAccess (string $cmd, string $permission, int $ref_id, int $obj_id, ?int $user_id=null)
 Checks whether a user may invoke a command or not (this method is called by ilAccessHandler::checkAccess) More...
 
 canBeDelivered (ilWACPath $ilWACPath)
 

Static Public Member Functions

static _getCommands ()
 
static _checkGoto (string $target)
 
static lookupOnline (int $a_obj_id)
 
- Static Public Member Functions inherited from ilObjectAccess
static _getCommands ()
 get commands More...
 
static _checkGoto (string $target)
 check whether goto script will succeed More...
 
static _isOffline (int $obj_id)
 Type-specific implementation of general status, has to be overwritten if object type does not support centralized offline handling. More...
 
static _preloadData (array $obj_ids, array $ref_ids)
 Preload data. More...
 

Static Private Member Functions

static checkRoomAccess (string $a_permission, int $a_ref_id, int $a_obj_id, int $a_user_id)
 

Static Private Attributes

static bool $chat_enabled = null
 

Detailed Description

Access class for chatroom objects.

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

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

Member Function Documentation

◆ _checkAccess()

ilObjChatroomAccess::_checkAccess ( string  $cmd,
string  $permission,
int  $ref_id,
int  $obj_id,
?int  $user_id = null 
)

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

References $GLOBALS, and $user_id.

56  : bool
57  {
58  if (!$user_id) {
59  $user_id = $GLOBALS['DIC']->user()->getId();
60  }
61 
62  return self::checkRoomAccess($permission, $ref_id, $obj_id, (int) $user_id);
63  }
$ref_id
Definition: ltiauth.php:65
$GLOBALS["DIC"]
Definition: wac.php:53

◆ _checkGoto()

static ilObjChatroomAccess::_checkGoto ( string  $target)
static

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

References ilChatroom\checkUserPermissions().

40  : bool
41  {
42  $t_arr = explode('_', $target);
43 
44  if (count($t_arr) < 2 || $t_arr[0] !== 'chtr' || ((int) $t_arr[1]) <= 0) {
45  return false;
46  }
47 
48  if (ilChatroom::checkUserPermissions('visible', (int) $t_arr[1], false) ||
49  ilChatroom::checkUserPermissions('read', (int) $t_arr[1], false)) {
50  return true;
51  }
52 
53  return false;
54  }
static checkUserPermissions($permissions, int $ref_id, bool $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 31 of file class.ilObjChatroomAccess.php.

Referenced by ilObjChatroomListGUI\init().

31  : array
32  {
33  $commands = [];
34  $commands[] = ['permission' => 'read', 'cmd' => 'view', 'lang_var' => 'enter', 'default' => true];
35  $commands[] = ['permission' => 'write', 'cmd' => 'settings-general', 'lang_var' => 'settings'];
36 
37  return $commands;
38  }
+ Here is the caller graph for this function:

◆ canBeDelivered()

ilObjChatroomAccess::canBeDelivered ( ilWACPath  $ilWACPath)

Implements ilWACCheckingClass.

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

101  : bool
102  {
103  return false;
104  }

◆ checkRoomAccess()

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

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

References $DIC, ilAccessInfo\IL_NO_OBJECT_ACCESS, and null.

65  : bool
66  {
67  global $DIC;
68 
69  if (self::$chat_enabled === null) {
70  $chatSetting = new ilSetting('chatroom');
71  self::$chat_enabled = (bool) $chatSetting->get('chat_enabled', '0');
72  }
73 
74  $hasWriteAccess = $DIC->rbac()->system()->checkAccessOfUser($a_user_id, 'write', $a_ref_id);
75  if ($hasWriteAccess) {
76  return true;
77  }
78 
79  switch ($a_permission) {
80  case 'read':
81  case 'visible':
82  $is_online = self::lookupOnline($a_obj_id);
83  if (!$is_online) {
84  $DIC->access()->addInfoItem(
86  $DIC->language()->txt('offline')
87  );
88  return false;
89  }
90  break;
91  }
92 
93  return self::$chat_enabled;
94  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:22

◆ lookupOnline()

static ilObjChatroomAccess::lookupOnline ( int  $a_obj_id)
static

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

References ilObject\lookupOfflineStatus().

96  : bool
97  {
98  return !ilObject::lookupOfflineStatus($a_obj_id);
99  }
static lookupOfflineStatus(int $obj_id)
Lookup offline status using objectDataCache.
+ Here is the call graph for this function:

Field Documentation

◆ $chat_enabled

bool ilObjChatroomAccess::$chat_enabled = null
staticprivate

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


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