ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilObjSessionAccess Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilObjSessionAccess:
+ Collaboration diagram for ilObjSessionAccess:

Public Member Functions

 __construct ()
 
 _checkAccess ($a_cmd, $a_permission, $a_ref_id, $a_obj_id, $a_user_id="")
 
 isRegistrationLimitExceeded (int $ref_id, int $obj_id)
 
- 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 ($a_target)
 
static _lookupRegistration (int $a_obj_id)
 
static _lookupRegistered (int $a_usr_id, int $a_obj_id)
 
static _preloadData ($a_obj_ids, $a_ref_ids)
 
static getBookingInfoRepo ()
 
- 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...
 

Protected Attributes

ilObjUser $user
 

Static Protected Attributes

static array $registrations = null
 
static array $registered = null
 
static ilBookingReservationDBRepository $booking_repo = null
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning

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

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

Constructor & Destructor Documentation

◆ __construct()

ilObjSessionAccess::__construct ( )

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

References $DIC, and ILIAS\Repository\user().

37  {
38  global $DIC;
39 
40  $this->user = $DIC->user();
41  }
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

Member Function Documentation

◆ _checkAccess()

ilObjSessionAccess::_checkAccess (   $a_cmd,
  $a_permission,
  $a_ref_id,
  $a_obj_id,
  $a_user_id = "" 
)

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

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

57  : bool
58  {
59  global $DIC;
60 
62 
63  if (!$a_user_id) {
64  $a_user_id = $ilUser->getId();
65  }
66 
67  switch ($a_cmd) {
68  case 'register':
69 
70  if (!self::_lookupRegistration($a_obj_id)) {
71  return false;
72  }
73  if ($ilUser->isAnonymous()) {
74  return false;
75  }
76  if (self::_lookupRegistered($a_user_id, $a_obj_id)) {
77  return false;
78  }
79  if (\ilSessionParticipants::_isSubscriber($a_obj_id, $a_user_id)) {
80  return false;
81  }
82  if (ilSessionWaitingList::_isOnList($a_user_id, $a_obj_id)) {
83  return false;
84  }
85  if ($this->isRegistrationLimitExceeded($a_ref_id, $a_obj_id)) {
86  return false;
87  }
88  break;
89 
90  case 'unregister':
91  if (self::_lookupRegistration($a_obj_id) && $a_user_id != ANONYMOUS_USER_ID) {
92  return self::_lookupRegistered($a_user_id, $a_obj_id);
93  }
94  return false;
95  }
96  return true;
97  }
const ANONYMOUS_USER_ID
Definition: constants.php:27
static _isSubscriber(int $a_obj_id, int $a_usr_id)
isRegistrationLimitExceeded(int $ref_id, int $obj_id)
global $DIC
Definition: feed.php:28
$ilUser
Definition: imgupload.php:34
static _isOnList(int $a_usr_id, int $a_obj_id)
+ Here is the call graph for this function:

◆ _checkGoto()

static ilObjSessionAccess::_checkGoto (   $a_target)
static

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

References $DIC.

112  : bool
113  {
114  global $DIC;
115 
116  $ilAccess = $DIC->access();
117 
118  $t_arr = explode("_", $a_target);
119 
120  if ($t_arr[0] != "sess" || ((int) $t_arr[1]) <= 0) {
121  return false;
122  }
123 
124  if ($ilAccess->checkAccess("read", "", (int) $t_arr[1]) ||
125  $ilAccess->checkAccess("visible", "", (int) $t_arr[1])) {
126  return true;
127  }
128  return false;
129  }
global $DIC
Definition: feed.php:28

◆ _getCommands()

static ilObjSessionAccess::_getCommands ( )
static

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

Referenced by ilObjSessionListGUI\init().

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

◆ _lookupRegistered()

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

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

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

149  : bool
150  {
151  global $DIC;
152 
153  $ilDB = $DIC->database();
154  $ilUser = $DIC->user();
155 
156  if (isset(self::$registered[$a_usr_id][$a_obj_id])) {
157  return (bool) self::$registered[$a_usr_id][$a_obj_id];
158  }
159 
160  $query = "SELECT event_id, registered FROM event_participants WHERE usr_id = " . $ilDB->quote($ilUser->getId(), 'integer');
161  $res = $ilDB->query($query);
162  self::$registered[$a_usr_id] = [];
163  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
164  self::$registered[$a_usr_id][$row->event_id] = (bool) $row->registered;
165  }
166  return (bool) (self::$registered[$a_usr_id][$a_obj_id] ?? false);
167  }
$res
Definition: ltiservices.php:69
global $DIC
Definition: feed.php:28
$query
$ilUser
Definition: imgupload.php:34

◆ _lookupRegistration()

static ilObjSessionAccess::_lookupRegistration ( int  $a_obj_id)
static

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

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

131  : bool
132  {
133  global $DIC;
134 
135  $ilDB = $DIC->database();
136 
137  if (!is_null(self::$registrations)) {
138  return (bool) self::$registrations[$a_obj_id];
139  }
140 
141  $query = "SELECT registration,obj_id FROM event ";
142  $res = $ilDB->query($query);
143  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
144  self::$registrations[$row->obj_id] = (bool) $row->registration;
145  }
146  return (bool) self::$registrations[$a_obj_id];
147  }
$res
Definition: ltiservices.php:69
global $DIC
Definition: feed.php:28
$query

◆ _preloadData()

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

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

References Vendor\Package\$f.

169  : void
170  {
172  self::$booking_repo = $f->getRepoWithContextObjCache($a_obj_ids);
173  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ getBookingInfoRepo()

static ilObjSessionAccess::getBookingInfoRepo ( )
static

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

Referenced by ilObjSessionListGUI\getProperties().

176  {
177  if (self::$booking_repo instanceof ilBookingReservationDBRepository) {
178  return self::$booking_repo;
179  }
180  return null;
181  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the caller graph for this function:

◆ isRegistrationLimitExceeded()

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

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

References ilSessionParticipants\getInstance().

Referenced by _checkAccess().

99  : bool
100  {
101  $session_data = new ilObjSession($obj_id, false);
102  if (!$session_data->isRegistrationUserLimitEnabled()) {
103  return false;
104  }
106  if ($part->getCountMembers() >= $session_data->getRegistrationMaxUsers()) {
107  return true;
108  }
109  return false;
110  }
$ref_id
Definition: ltiauth.php:67
static getInstance(int $a_ref_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $booking_repo

ilBookingReservationDBRepository ilObjSessionAccess::$booking_repo = null
staticprotected

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

◆ $registered

array ilObjSessionAccess::$registered = null
staticprotected

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

◆ $registrations

array ilObjSessionAccess::$registrations = null
staticprotected

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

◆ $user

ilObjUser ilObjSessionAccess::$user
protected

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

Referenced by _checkAccess().


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