ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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...
 

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

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

74  {
75  global $ilUser, $lng, $rbacsystem, $ilAccess;
76 
77  if(!$a_user_id)
78  {
79  $a_user_id = $ilUser->getId();
80  }
81  include_once './Modules/Session/classes/class.ilSessionParticipants.php';
83 
84  switch($a_cmd)
85  {
86  case 'register':
87 
88  if(!self::_lookupRegistration($a_obj_id))
89  {
90  //ilLoggerFactory::getLogger('sess')->debug('Lookup registration failed: register access denied.');
91  return false;
92  }
93  if($ilUser->isAnonymous())
94  {
95  //ilLoggerFactory::getLogger('sess')->debug('User is anoynmous: register access denied.');
96  return false;
97  }
98  if($part->isAssigned($a_user_id))
99  {
100  //ilLoggerFactory::getLogger('sess')->debug('User is assigned: register access denied.');
101  return false;
102  }
103  if($part->isSubscriber($a_user_id))
104  {
105  //ilLoggerFactory::getLogger('sess')->debug('User is subscriber: register access denied.');
106  return false;
107  }
108  include_once './Modules/Session/classes/class.ilSessionWaitingList.php';
109  if(ilSessionWaitingList::_isOnList($a_user_id, $a_obj_id))
110  {
111  //ilLoggerFactory::getLogger('sess')->debug('User is on waiting list: register access denied.');
112  return false;
113  }
114  break;
115 
116  case 'unregister':
117  if(self::_lookupRegistration($a_obj_id) && $a_user_id != ANONYMOUS_USER_ID)
118  {
119  return self::_lookupRegistered($a_user_id,$a_obj_id);
120  }
121  return false;
122  }
123  return true;
124  }
$ilUser
Definition: imgupload.php:18
static _isOnList($a_usr_id, $a_obj_id)
Check if a user on the waiting list.
global $lng
Definition: privfeed.php:17
static getInstanceByObjId($a_obj_id)
Get instance by obj type.
+ Here is the call graph for this function:

◆ _checkGoto()

static ilObjSessionAccess::_checkGoto (   $a_target)
static

check whether goto script will succeed

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

131  {
132  global $ilAccess;
133 
134  $t_arr = explode("_", $a_target);
135 
136  if ($t_arr[0] != "sess" || ((int) $t_arr[1]) <= 0)
137  {
138  return false;
139  }
140 
141  if($ilAccess->checkAccess("read", "", $t_arr[1]))
142  {
143  return true;
144  }
145  return false;
146  }

◆ _getCommands()

static ilObjSessionAccess::_getCommands ( )
static

get list of command/permission combinations

public

Returns
array

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

References array.

Referenced by ilObjSessionListGUI\init().

47  {
48  $commands = array
49  (
50  array("permission" => "read", "cmd" => "infoScreen", "lang_var" => "info_short", "default" => true),
51  array("permission" => "read", "cmd" => "register", "lang_var" => "join_session"),
52  array("permission" => "read", "cmd" => "unregister", "lang_var" => "event_unregister"),
53  array("permission" => "write", "cmd" => "edit", "lang_var" => "settings"),
54  array("permission" => "write", "cmd" => "materials", "lang_var" => "crs_objective_add_mat"),
55  array('permission' => 'write', 'cmd' => 'members', 'lang_var' => 'event_edit_members')
56  );
57 
58  return $commands;
59  }
Create styles array
The data for the language used.
+ 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 183 of file class.ilObjSessionAccess.php.

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

184  {
185  if(isset(self::$registered[$a_usr_id]))
186  {
187  return (bool) self::$registered[$a_usr_id][$a_obj_id];
188  }
189 
190  global $ilDB,$ilUser;
191 
192  $query = "SELECT event_id, registered FROM event_participants WHERE usr_id = ".$ilDB->quote($ilUser->getId(),'integer');
193  $res = $ilDB->query($query);
194  self::$registered[$a_usr_id] = array();
195  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
196  {
197  self::$registered[$a_usr_id][$row->event_id] = (bool) $row->registered;
198  }
199  return (bool) self::$registered[$a_usr_id][$a_obj_id];
200  }
$ilUser
Definition: imgupload.php:18
Create styles array
The data for the language used.
global $ilDB

◆ _lookupRegistration()

static ilObjSessionAccess::_lookupRegistration (   $a_obj_id)
static

lookup registrations

public

Parameters

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

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

157  {
158  if(!is_null(self::$registrations))
159  {
160  return self::$registrations[$a_obj_id];
161  }
162 
163  global $ilDB;
164 
165  $query = "SELECT registration,obj_id FROM event ";
166  $res = $ilDB->query($query);
167  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
168  {
169  self::$registrations[$row->obj_id] = (bool) $row->registration;
170  }
171  return self::$registrations[$a_obj_id];
172  }
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: