ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilObjSessionAccess Class Reference
+ 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)
 
 canBeDelivered (ilWACPath $ilWACPath)
 

Static Public Member Functions

static _getCommands ()
 get commands More...
 
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 ILIAS BookingManager Reservations ReservationDBRepository $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 28 of file class.ilObjSessionAccess.php.

Constructor & Destructor Documentation

◆ __construct()

ilObjSessionAccess::__construct ( )

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

36 {
37 global $DIC;
38
39 $this->user = $DIC->user();
40 }
global $DIC
Definition: shib_login.php:26

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

+ 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 56 of file class.ilObjSessionAccess.php.

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

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

+ Here is the call graph for this function:

◆ _checkGoto()

static ilObjSessionAccess::_checkGoto (   $a_target)
static

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

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

References $DIC.

◆ _getCommands()

static ilObjSessionAccess::_getCommands ( )
static

get commands

this method returns an array of all possible commands/permission combinations

example: $commands = array ( array("permission" => "read", "cmd" => "view", "lang_var" => "show"), array("permission" => "write", "cmd" => "edit", "lang_var" => "edit"), );

Returns
array{permission?:string, cmd?:string, lang_var?:string, default?:bool}[]

Reimplemented from ilObjectAccess.

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

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

Referenced by ilObjSessionListGUI\init().

+ Here is the caller graph for this function:

◆ _lookupRegistered()

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

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

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

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

Referenced by _checkAccess().

+ Here is the caller graph for this function:

◆ _lookupRegistration()

static ilObjSessionAccess::_lookupRegistration ( int  $a_obj_id)
static

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

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

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

◆ _preloadData()

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

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

168 : void
169 {
170 global $DIC;
171
172 self::$booking_repo = $DIC->bookingManager()
173 ->internal()
174 ->repo()
175 ->reservationWithContextObjCache($a_obj_ids);
176 }

References $DIC.

◆ getBookingInfoRepo()

static ilObjSessionAccess::getBookingInfoRepo ( )
static

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

179 {
180 if (self::$booking_repo instanceof \ILIAS\BookingManager\Reservations\ReservationDBRepository) {
181 return self::$booking_repo;
182 }
183 return null;
184 }
Repo class for reservations Acts on tables booking_reservation (rw), booking_reservation_group (rw) a...
static ILIAS BookingManager Reservations ReservationDBRepository $booking_repo
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.

References $booking_repo.

Referenced by ilObjSessionListGUI\getProperties().

+ Here is the caller graph for this function:

◆ isRegistrationLimitExceeded()

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

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

98 : bool
99 {
100 $session_data = new ilObjSession($obj_id, false);
101 if (!$session_data->isRegistrationUserLimitEnabled()) {
102 return false;
103 }
105 if ($part->getCountMembers() >= $session_data->getRegistrationMaxUsers()) {
106 return true;
107 }
108 return false;
109 }
static getInstance(int $a_ref_id)
$ref_id
Definition: ltiauth.php:66

References $ref_id, and ilSessionParticipants\getInstance().

Referenced by _checkAccess().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $booking_repo

ILIAS BookingManager Reservations ReservationDBRepository ilObjSessionAccess::$booking_repo = null
staticprotected

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

Referenced by getBookingInfoRepo().

◆ $registered

array ilObjSessionAccess::$registered = null
staticprotected

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

◆ $registrations

array ilObjSessionAccess::$registrations = null
staticprotected

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

◆ $user

ilObjUser ilObjSessionAccess::$user
protected

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

Referenced by _checkAccess().


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