ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
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...
 
 isRegistrationLimitExceeded (int $ref_id, int $obj_id)
 
- 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 _preloadData ($a_obj_ids, $a_ref_ids)
 Preload data. More...
 
static getBookingInfoRepo ()
 Get booking info repo. 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
 
static $booking_repo = 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 77 of file class.ilObjSessionAccess.php.

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

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

◆ _checkGoto()

static ilObjSessionAccess::_checkGoto (   $a_target)
static

check whether goto script will succeed

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

References $DIC.

141  {
142  global $DIC;
143 
144  $ilAccess = $DIC['ilAccess'];
145 
146  $t_arr = explode("_", $a_target);
147 
148  if ($t_arr[0] != "sess" || ((int) $t_arr[1]) <= 0) {
149  return false;
150  }
151 
152  if ($ilAccess->checkAccess("read", "", $t_arr[1]) ||
153  $ilAccess->checkAccess("visible", "", $t_arr[1])) {
154  return true;
155  }
156  return false;
157  }
global $DIC
Definition: goto.php:24

◆ _getCommands()

static ilObjSessionAccess::_getCommands ( )
static

get list of command/permission combinations

public

Returns
array

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

Referenced by ilObjSessionListGUI\init().

52  {
53  $commands = array(
54  array("permission" => "read", "cmd" => "infoScreen", "lang_var" => "info_short", "default" => true),
55  array("permission" => "read", "cmd" => "register", "lang_var" => "join_session"),
56  array("permission" => "read", "cmd" => "unregister", "lang_var" => "event_unregister"),
57  array("permission" => "write", "cmd" => "edit", "lang_var" => "settings"),
58  array("permission" => "manage_materials", "cmd" => "materials", "lang_var" => "crs_objective_add_mat"),
59  array('permission' => 'manage_members', 'cmd' => 'members', 'lang_var' => 'event_edit_members')
60  );
61 
62  return $commands;
63  }
+ 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 194 of file class.ilObjSessionAccess.php.

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

195  {
196  if (isset(self::$registered[$a_usr_id])) {
197  return (bool) self::$registered[$a_usr_id][$a_obj_id];
198  }
199 
200  global $DIC;
201 
202  $ilDB = $DIC['ilDB'];
203  $ilUser = $DIC['ilUser'];
204 
205  $query = "SELECT event_id, registered FROM event_participants WHERE usr_id = " . $ilDB->quote($ilUser->getId(), 'integer');
206  $res = $ilDB->query($query);
207  self::$registered[$a_usr_id] = array();
208  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
209  self::$registered[$a_usr_id][$row->event_id] = (bool) $row->registered;
210  }
211  return (bool) self::$registered[$a_usr_id][$a_obj_id];
212  }
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
$query
global $ilDB
$ilUser
Definition: imgupload.php:18

◆ _lookupRegistration()

static ilObjSessionAccess::_lookupRegistration (   $a_obj_id)
static

lookup registrations

public

Parameters

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

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

168  {
169  if (!is_null(self::$registrations)) {
170  return self::$registrations[$a_obj_id];
171  }
172 
173  global $DIC;
174 
175  $ilDB = $DIC['ilDB'];
176 
177  $query = "SELECT registration,obj_id FROM event ";
178  $res = $ilDB->query($query);
179  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
180  self::$registrations[$row->obj_id] = (bool) $row->registration;
181  }
182  return self::$registrations[$a_obj_id];
183  }
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
$query
global $ilDB

◆ _preloadData()

static ilObjSessionAccess::_preloadData (   $a_obj_ids,
  $a_ref_ids 
)
static

Preload data.

Parameters
array$a_obj_idsarray of object ids

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

References Vendor\Package\$f.

220  {
222  self::$booking_repo = $f->getRepoWithContextObjCache($a_obj_ids);
223  }

◆ getBookingInfoRepo()

static ilObjSessionAccess::getBookingInfoRepo ( )
static

Get booking info repo.

Returns
ilBookingReservationDBRepository

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

Referenced by ilObjSessionListGUI\getProperties().

230  {
231  return self::$booking_repo;
232  }
+ Here is the caller graph for this function:

◆ isRegistrationLimitExceeded()

ilObjSessionAccess::isRegistrationLimitExceeded ( int  $ref_id,
int  $obj_id 
)

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

References ilSessionParticipants\getInstance().

Referenced by _checkAccess().

123  : bool
124  {
125  $session_data = new ilObjSession($obj_id, false);
126  if (!$session_data->isRegistrationUserLimitEnabled()) {
127  return false;
128  }
130  if ($part->getCountMembers() >= $session_data->getRegistrationMaxUsers()) {
131  return true;
132  }
133  return false;
134  }
static getInstance($a_ref_id)
Get instance.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $booking_repo

ilObjSessionAccess::$booking_repo = null
staticprotected

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

◆ $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: