ILIAS  release_8 Revision v8.24
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)
 
 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 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.

37 {
38 global $DIC;
39
40 $this->user = $DIC->user();
41 }
global $DIC
Definition: feed.php:28

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

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 }
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
$ilUser
Definition: imgupload.php:34

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

+ Here is the call graph for this function:

◆ _checkGoto()

static ilObjSessionAccess::_checkGoto (   $a_target)
static

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

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 }

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

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 }

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

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
$query

References $DIC, $ilDB, $ilUser, $query, $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 131 of file class.ilObjSessionAccess.php.

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 }

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

◆ _preloadData()

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

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

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...

References Vendor\Package\$f.

◆ getBookingInfoRepo()

static ilObjSessionAccess::getBookingInfoRepo ( )
static

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

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...
static ilBookingReservationDBRepository $booking_repo

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

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 }
static getInstance(int $a_ref_id)
$ref_id
Definition: ltiauth.php:67

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

ilBookingReservationDBRepository ilObjSessionAccess::$booking_repo = null
staticprotected

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

Referenced by getBookingInfoRepo().

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