62 (isset($ilDB)) ? $this->
ilDB =& $ilDB : $this->
ilDB =& $ilias->db;
107 $ilBench->start(
"RBAC",
"system_checkAccess");
111 $ilBench->stop(
"RBAC",
"system_checkAccess");
118 global $ilUser, $rbacreview,$ilObjDataCache,
$ilDB,
$ilLog;
121 $cacheKey = $a_user_id.
':'.$a_operations.
':'.$a_ref_id.
':'.$a_type;
124 if (! is_array(self::$_checkAccessOfUserCache)) {
125 self::$_checkAccessOfUserCache = array();
129 if (array_key_exists($cacheKey, self::$_checkAccessOfUserCache)) {
130 return self::$_checkAccessOfUserCache[$cacheKey];
144 if (count(self::$_checkAccessOfUserCache) < 1000) {
145 self::$_checkAccessOfUserCache[$cacheKey] =
true;
155 if (in_array(SYSTEM_ROLE_ID, $roles))
159 if (count(self::$_checkAccessOfUserCache) < 1000) {
160 self::$_checkAccessOfUserCache[$cacheKey] =
true;
165 if (!isset($a_operations) or !isset($a_ref_id))
168 $this->ilErr->raiseError(get_class($this).
"::checkAccess(): Missing parameter! ".
169 "ref_id: ".$a_ref_id.
" operations: ".$a_operations,$this->ilErr->WARNING);
172 if (!is_string($a_operations))
175 $this->ilErr->raiseError(get_class($this).
"::checkAccess(): Wrong datatype for operations!",$this->ilErr->WARNING);
179 $paCacheKey = $a_user_id.
':'.$a_ref_id;
180 if (! is_array(self::$_paCache)) {
181 self::$_paCache = array();
184 if (array_key_exists($paCacheKey, self::$_paCache)) {
186 $ops = self::$_paCache[$paCacheKey];
191 $q =
"SELECT * FROM rbac_pa ".
192 "WHERE ref_id = ".$ilDB->quote($a_ref_id,
'integer');
200 if (in_array(
$row->rol_id, $roles))
202 $ops = array_merge($ops,unserialize(stripslashes(
$row->ops_id)));
206 if (count(self::$_paCache) < 1000)
208 self::$_paCache[$paCacheKey] = $ops;
212 $operations = explode(
",",$a_operations);
213 foreach ($operations as $operation)
215 if ($operation ==
"create")
219 $this->ilErr->raiseError(get_class($this).
"::CheckAccess(): Expect a type definition for checking a 'create' permission",
220 $this->ilErr->WARNING);
229 if (! in_array($ops_id,$ops))
234 if (count(self::$_checkAccessOfUserCache) < 1000)
236 self::$_checkAccessOfUserCache[$cacheKey] =
false;
244 if (count(self::$_checkAccessOfUserCache) < 1000)
247 self::$_checkAccessOfUserCache[$cacheKey] =
true;
266 $query =
'SELECT ops_id FROM rbac_operations '.
267 'WHERE operation = '.$ilDB->quote($a_operation,
'text');
269 while(
$row = $ilDB->fetchObject(
$res))
271 $ops_id =
$row->ops_id;
274 $query =
"SELECT * FROM rbac_pa ".
275 "WHERE rol_id = ".$ilDB->quote($a_rol_id,
'integer').
" ".
276 "AND ref_id = ".$ilDB->quote($a_ref_id,
'integer').
" ";
279 while(
$row = $ilDB->fetchObject(
$res))
281 $ops = array_merge($ops,unserialize(
$row->ops_id));
283 return in_array($ops_id,$ops);
288 global $ilObjDataCache,$ilUser;
291 if($this->mem_view[
'active'] and $a_user_id == $ilUser->getId())
293 if(in_array($a_ref_id, $this->mem_view[
'items']))
295 return $a_operations;
299 if($a_user_id != $ilObjDataCache->lookupOwner($ilObjDataCache->lookupObjId($a_ref_id)))
301 return $a_operations;
304 foreach(explode(
",",$a_operations) as $operation)
306 if($operation !=
'cat_administrate_users' and $operation !=
'edit_permission' and !preg_match(
'/^create/',$operation))
310 if(!strlen($new_ops))
312 $new_ops = $operation;
316 $new_ops .= (
','.$operation);
334 global $ilUser,$rbacreview;
337 if($this->mem_view[
'active'] and $a_usr_id == $ilUser->getId())
340 if(in_array($a_ref_id, $this->mem_view[
'items']) and $this->mem_view[
'role'])
343 return array($this->mem_view[
'role']);
347 if(isset(self::$user_role_cache[$a_usr_id]) and is_array(self::$user_role_cache))
349 return self::$user_role_cache[$a_usr_id];
354 return self::$user_role_cache[$a_usr_id] = $rbacreview->assignedRoles($a_usr_id);
363 include_once
'./Services/Container/classes/class.ilMemberViewSettings.php';
365 if($settings->isEnabled() and isset(
$_GET[
'mv']))
367 $settings->toggleActivation((
int)
$_GET[
'ref_id'], (
int) $_GET[
'mv']);
370 if(!$settings->isActive())
372 $this->mem_view[
'active'] =
false;
373 $this->mem_view[
'items'] = array();
374 $this->mem_view[
'role'] = 0;
380 $this->mem_view[
'active'] =
true;
381 $this->mem_view[
'items'] = $tree->getSubTreeIds($settings->getContainer());
382 $this->mem_view[
'items'] = array_merge($this->mem_view[
'items'],array($settings->getContainer()));
383 include_once
'./Services/Membership/classes/class.ilParticipants.php';