ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilObjSessionAccess Class Reference
+ Inheritance diagram for ilObjSessionAccess:
+ Collaboration diagram for ilObjSessionAccess:

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) 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 ()
 get list of command/permission combinations More...
 
static _checkGoto ($a_target)
 check whether goto script will succeed More...
 
static _lookupRegistration ($a_obj_id)
 lookup registrations More...
 
static _lookupRegistered ($a_usr_id, $a_obj_id)
 lookup if user has registered More...
 
- 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 Protected Attributes

static $registrations = null
 
static $registered = null
 

Detailed Description

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 34 of file class.ilObjSessionAccess.php.

Member Function Documentation

◆ _checkAccess()

ilObjSessionAccess::_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)

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

Definition at line 72 of file class.ilObjSessionAccess.php.

References $DIC, $ilUser, $lng, ilWaitingList\_isOnList(), and ilParticipants\_isSubscriber().

73  {
74  global $DIC;
75 
76  $ilUser = $DIC['ilUser'];
77  $lng = $DIC['lng'];
78  $rbacsystem = $DIC['rbacsystem'];
79  $ilAccess = $DIC['ilAccess'];
80 
81  if (!$a_user_id) {
82  $a_user_id = $ilUser->getId();
83  }
84 
85  switch ($a_cmd) {
86  case 'register':
87 
88  if (!self::_lookupRegistration($a_obj_id)) {
89  return false;
90  }
91  if ($ilUser->isAnonymous()) {
92  return false;
93  }
94  if (self::_lookupRegistered($a_user_id, $a_obj_id)) {
95  return false;
96  }
97  if (\ilSessionParticipants::_isSubscriber($a_obj_id, $a_user_id)) {
98  return false;
99  }
100  include_once './Modules/Session/classes/class.ilSessionWaitingList.php';
101  if (ilSessionWaitingList::_isOnList($a_user_id, $a_obj_id)) {
102  return false;
103  }
104  break;
105 
106  case 'unregister':
107  if (self::_lookupRegistration($a_obj_id) && $a_user_id != ANONYMOUS_USER_ID) {
108  return self::_lookupRegistered($a_user_id, $a_obj_id);
109  }
110  return false;
111  }
112  return true;
113  }
static _isSubscriber($a_obj_id, $a_usr_id)
check if user is subscriber
global $DIC
Definition: saml.php:7
$lng
$ilUser
Definition: imgupload.php:18
static _isOnList($a_usr_id, $a_obj_id)
Check if a user on the waiting list.
+ Here is the call graph for this function:

◆ _checkGoto()

static ilObjSessionAccess::_checkGoto (   $a_target)
static

check whether goto script will succeed

Definition at line 119 of file class.ilObjSessionAccess.php.

References $DIC.

120  {
121  global $DIC;
122 
123  $ilAccess = $DIC['ilAccess'];
124 
125  $t_arr = explode("_", $a_target);
126 
127  if ($t_arr[0] != "sess" || ((int) $t_arr[1]) <= 0) {
128  return false;
129  }
130 
131  if ($ilAccess->checkAccess("read", "", $t_arr[1])) {
132  return true;
133  }
134  return false;
135  }
global $DIC
Definition: saml.php:7

◆ _getCommands()

static ilObjSessionAccess::_getCommands ( )
static

get list of command/permission combinations

public

Returns
array

Definition at line 46 of file class.ilObjSessionAccess.php.

Referenced by ilObjSessionListGUI\init().

47  {
48  $commands = array(
49  array("permission" => "read", "cmd" => "infoScreen", "lang_var" => "info_short", "default" => true),
50  array("permission" => "read", "cmd" => "register", "lang_var" => "join_session"),
51  array("permission" => "read", "cmd" => "unregister", "lang_var" => "event_unregister"),
52  array("permission" => "write", "cmd" => "edit", "lang_var" => "settings"),
53  array("permission" => "manage_materials", "cmd" => "materials", "lang_var" => "crs_objective_add_mat"),
54  array('permission' => 'manage_members', 'cmd' => 'members', 'lang_var' => 'event_edit_members')
55  );
56 
57  return $commands;
58  }
+ Here is the caller graph for this function:

◆ _lookupRegistered()

static ilObjSessionAccess::_lookupRegistered (   $a_usr_id,
  $a_obj_id 
)
static

lookup if user has registered

public

Parameters
intusr_id
intobj_id
Returns

Definition at line 172 of file class.ilObjSessionAccess.php.

References $DIC, $ilDB, $ilUser, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

173  {
174  if (isset(self::$registered[$a_usr_id])) {
175  return (bool) self::$registered[$a_usr_id][$a_obj_id];
176  }
177 
178  global $DIC;
179 
180  $ilDB = $DIC['ilDB'];
181  $ilUser = $DIC['ilUser'];
182 
183  $query = "SELECT event_id, registered FROM event_participants WHERE usr_id = " . $ilDB->quote($ilUser->getId(), 'integer');
184  $res = $ilDB->query($query);
185  self::$registered[$a_usr_id] = array();
186  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
187  self::$registered[$a_usr_id][$row->event_id] = (bool) $row->registered;
188  }
189  return (bool) self::$registered[$a_usr_id][$a_obj_id];
190  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$ilUser
Definition: imgupload.php:18
$query
$row
global $ilDB

◆ _lookupRegistration()

static ilObjSessionAccess::_lookupRegistration (   $a_obj_id)
static

lookup registrations

public

Parameters

Definition at line 145 of file class.ilObjSessionAccess.php.

References $DIC, $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

146  {
147  if (!is_null(self::$registrations)) {
148  return self::$registrations[$a_obj_id];
149  }
150 
151  global $DIC;
152 
153  $ilDB = $DIC['ilDB'];
154 
155  $query = "SELECT registration,obj_id FROM event ";
156  $res = $ilDB->query($query);
157  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
158  self::$registrations[$row->obj_id] = (bool) $row->registration;
159  }
160  return self::$registrations[$a_obj_id];
161  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
$row
global $ilDB

Field Documentation

◆ $registered

ilObjSessionAccess::$registered = null
staticprotected

Definition at line 37 of file class.ilObjSessionAccess.php.

◆ $registrations

ilObjSessionAccess::$registrations = null
staticprotected

Definition at line 36 of file class.ilObjSessionAccess.php.


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