ILIAS  Release_4_1_x_branch Revision 61804
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilAccessHandler.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 require_once("Services/AccessControl/classes/class.ilAccessInfo.php");
5 
21 {
22  protected $stored_rbac_access = array();
23 
27  function ilAccessHandler()
28  {
29  global $rbacsystem,$lng;
30 
31  $this->rbacsystem =& $rbacsystem;
32  $this->results = array();
33  $this->current_info = new ilAccessInfo();
34 
35  // use function enable to switch on/off tests (only cache is used so far)
36  $this->cache = true;
37  $this->rbac = true;
38  $this->tree = true;
39  $this->condition = true;
40  $this->path = true;
41  $this->status = true;
42  $this->obj_id_cache = array();
43  $this->obj_type_cache = array();
44  $this->obj_tree_cache=array();
45  }
46 
57  function storeAccessResult($a_permission, $a_cmd, $a_ref_id, $a_access_granted, $a_user_id = "",$a_info = "")
58  {
59  global $ilUser;
60 
61  if ($a_user_id == "")
62  {
63  $a_user_id = $ilUser->getId();
64  }
65 
66  if ($a_info == "")
67  {
68  $a_info = $this->current_info;
69  }
70 
71  //var_dump("<pre>",$a_permission,"</pre>");
72 
73  if ($this->cache)
74  {
75  $this->results[$a_ref_id][$a_permission][$a_cmd][$a_user_id] =
76  array("granted" => $a_access_granted, "info" => $a_info,
77  "prevent_db_cache" => $this->getPreventCachingLastResult());
78 //echo "<br>write-$a_ref_id-$a_permission-$a_cmd-$a_user_id-$a_access_granted-";
79  $this->current_result_element = array($a_access_granted,$a_ref_id,$a_permission,$a_cmd,$a_user_id);
80  $this->last_result = $this->results[$a_ref_id][$a_permission][$a_cmd][$a_user_id];
81  $this->last_info = $a_info;
82  }
83 
84  // get new info object
85  $this->current_info = new ilAccessInfo();
86 
87  }
88 
94  function setPreventCachingLastResult($a_val)
95  {
96  $this->prevent_caching_last_result = $a_val;
97  }
98 
105  {
106  return $this->prevent_caching_last_result;
107  }
108 
121  function getStoredAccessResult($a_permission, $a_cmd, $a_ref_id, $a_user_id = "")
122  {
123  global $ilUser;
124 
125  if ($a_user_id == "")
126  {
127  $a_user_id = $ilUser->getId();
128  }
129 
130  /*if (is_object($this->results[$a_ref_id][$a_permission][$a_cmd][$a_user_id]['info']))
131  {
132  $this->current_info = $this->results[$a_ref_id][$a_permission][$a_cmd][$a_user_id]['info'];
133  }*/
134 
135  if (isset($this->results[$a_ref_id][$a_permission][$a_cmd][$a_user_id]))
136  {
137  return $this->results[$a_ref_id][$a_permission][$a_cmd][$a_user_id];
138  }
139  return false;
140  }
141 
142  function storeCache()
143  {
144  global $ilDB, $ilUser;
145 
146  $query = "DELETE FROM acc_cache WHERE user_id = ".$ilDB->quote($ilUser->getId(),'integer');
147  $res = $ilDB->manipulate($query);
148 
149  $ilDB->insert('acc_cache', array(
150  'user_id' => array('integer',$ilUser->getId()),
151  'time' => array('integer',time()),
152  'result' => array('clob',serialize($this->results))
153  ));
154  }
155 
156  function readCache($a_secs = 0)
157  {
158  global $ilUser, $ilDB;
159 
160  if ($a_secs > 0)
161  {
162  $query = "SELECT * FROM acc_cache WHERE user_id = ".
163  $ilDB->quote($ilUser->getId() ,'integer');
164  $set = $ilDB->query($query);
165  $rec = $set->fetchRow(DB_FETCHMODE_ASSOC);
166  if ((time() - $rec["time"]) < $a_secs)
167  {
168  $this->results = unserialize($rec["result"]);
169 //var_dump($this->results);
170  return true;
171  }
172  }
173  return false;
174  }
175 
176  function getResults()
177  {
178  return $this->results;
179  }
180 
181  function setResults($a_results)
182  {
183  $this->results = $a_results;
184  }
185 
189  function addInfoItem($a_type, $a_text, $a_data = "")
190  {
191  $this->current_info->addInfoItem($a_type, $a_text, $a_data);
192  }
193 
206  function checkAccess($a_permission, $a_cmd, $a_ref_id, $a_type = "", $a_obj_id = "", $a_tree_id="")
207  {
208  global $ilUser;
209 
210  return $this->checkAccessOfUser($ilUser->getId(),$a_permission, $a_cmd, $a_ref_id, $a_type, $a_obj_id, $a_tree_id);
211  }
212 
226  function checkAccessOfUser($a_user_id,$a_permission, $a_cmd, $a_ref_id, $a_type = "", $a_obj_id = "", $a_tree_id="")
227  {
228  global $ilBench, $lng;
229 
230  $this->setPreventCachingLastResult(false); // for external db based caches
231 
232  $ilBench->start("AccessControl", "0400_clear_info");
233  $this->current_info->clear();
234  $ilBench->stop("AccessControl", "0400_clear_info");
235 
236 
237  // get stored result (internal memory based cache)
238  $cached = $this->doCacheCheck($a_permission, $a_cmd, $a_ref_id, $a_user_id);
239  if ($cached["hit"])
240  {
241  // Store access result
242  if (!$cached["granted"])
243  {
244  $this->current_info->addInfoItem(IL_NO_PERMISSION, $lng->txt("status_no_permission"));
245  }
246  if ($cached["prevent_db_cache"])
247  {
248  $this->setPreventCachingLastResult(true); // should have been saved in previous call already
249  }
250  return $cached["granted"];
251  }
252 
253  $ilBench->start("AccessControl", "0500_lookup_id_and_type");
254  // get object id if not provided
255  if ($a_obj_id == "")
256  {
257  if (isset($this->obj_id_cache[$a_ref_id]) && $this->obj_id_cache[$a_ref_id] > 0)
258  {
259  $a_obj_id = $this->obj_id_cache[$a_ref_id];
260  }
261  else
262  {
263  $a_obj_id = ilObject::_lookupObjId($a_ref_id);
264  $this->obj_id_cache[$a_ref_id] = $a_obj_id;
265  }
266  }
267  if ($a_type == "")
268  {
269  if (isset($this->obj_type_cache[$a_ref_id]) && $this->obj_type_cache[$a_ref_id] != "")
270  {
271  $a_type = $this->obj_type_cache[$a_ref_id];
272  }
273  else
274  {
275  $a_type = ilObject::_lookupType($a_ref_id, true);
276  $this->obj_type_cache[$a_ref_id] = $a_type;
277  }
278  }
279 
280  $ilBench->stop("AccessControl", "0500_lookup_id_and_type");
281 
282  // to do: payment handling
283 
284  // if supplied tree id is not = 1 (= repository main tree),
285  // check if object is in tree and not deleted
286  if ($a_tree_id != 1 &&
287  !$this->doTreeCheck($a_permission, $a_cmd, $a_ref_id, $a_user_id))
288  {
289  $this->current_info->addInfoItem(IL_NO_PERMISSION, $lng->txt("status_no_permission"));
290  $this->storeAccessResult($a_permission, $a_cmd, $a_ref_id, false, $a_user_id);
291  return false;
292  }
293 
294  // rbac check for current object
295  if (!$this->doRBACCheck($a_permission, $a_cmd, $a_ref_id, $a_user_id, $a_type))
296  {
297  $this->current_info->addInfoItem(IL_NO_PERMISSION, $lng->txt("status_no_permission"));
298  $this->storeAccessResult($a_permission, $a_cmd, $a_ref_id, false, $a_user_id);
299  return false;
300  }
301 
302  // check read permission for all parents
303  $par_check = $this->doPathCheck($a_permission, $a_cmd, $a_ref_id, $a_user_id);
304  if (!$par_check)
305  {
306 
307  $this->current_info->addInfoItem(IL_NO_PERMISSION, $lng->txt("status_no_permission"));
308  $this->storeAccessResult($a_permission, $a_cmd, $a_ref_id, false, $a_user_id);
309  return false;
310  }
311 
312  // condition check (currently only implemented for read permission)
313  if (!$this->doConditionCheck($a_permission, $a_cmd, $a_ref_id, $a_user_id, $a_obj_id, $a_type))
314  {
315  $this->current_info->addInfoItem(IL_NO_PERMISSION, $lng->txt("status_no_permission"));
316  $this->storeAccessResult($a_permission, $a_cmd, $a_ref_id, false, $a_user_id);
317  $this->setPreventCachingLastResult(true); // do not store this in db, since condition updates are not monitored
318  return false;
319  }
320 
321  // object type specific check
322  if (!$this->doStatusCheck($a_permission, $a_cmd, $a_ref_id, $a_user_id, $a_obj_id, $a_type))
323  {
324  $this->current_info->addInfoItem(IL_NO_PERMISSION, $lng->txt("status_no_permission"));
325  $this->storeAccessResult($a_permission, $a_cmd, $a_ref_id, false, $a_user_id);
326  $this->setPreventCachingLastResult(true); // do not store this in db, since status updates are not monitored
327  return false;
328  }
329 
330  // check for available licenses
331  if (!$this->doLicenseCheck($a_permission, $a_cmd, $a_ref_id, $a_user_id, $a_obj_id, $a_type))
332  {
333  $this->setPreventCachingLastResult(true); // do not store this in db, since status updates are not monitored
334  return false;
335  }
336 
337  // all checks passed
338  $this->storeAccessResult($a_permission, $a_cmd, $a_ref_id, true, $a_user_id);
339  return true;
340  }
341 
345  function getInfo()
346  {
347  //return $this->last_result;
348  //$this->last_info->setQueryData($this->current_result_element);
349  //var_dump("<pre>",$this->results,"</pre>");
350  return is_object($this->last_info) ? $this->last_info->getInfoItems() : array();
351  }
352 
356  function getResultLast()
357  {
358  return $this->last_result;
359  }
360 
361  function getResultAll($a_ref_id = "")
362  {
363  if ($a_ref_id == "")
364  {
365  return $this->results;
366  }
367 
368  return $this->results[$a_ref_id];
369  }
370 
375  function doCacheCheck($a_permission, $a_cmd, $a_ref_id,$a_user_id)
376  {
377  global $ilBench;
378  //echo "cacheCheck<br/>";
379 
380  $ilBench->start("AccessControl", "1000_checkAccess_get_cache_result");
381  $stored_access = $this->getStoredAccessResult($a_permission, $a_cmd, $a_ref_id,$a_user_id);
382  //var_dump($stored_access);
383  if (is_array($stored_access))
384  {
385  $this->current_info = $stored_access["info"];
386  //var_dump("cache-treffer:");
387  $ilBench->stop("AccessControl", "1000_checkAccess_get_cache_result");
388  return array("hit" => true, "granted" => $stored_access["granted"],
389  "prevent_db_cache" => $stored_access["prevent_db_cache"]);
390  }
391 
392  // not in cache
393  $ilBench->stop("AccessControl", "1000_checkAccess_get_cache_result");
394  return array("hit" => false, "granted" => false,
395  "prevent_db_cache" => false);
396  }
397 
402  function doTreeCheck($a_permission, $a_cmd, $a_ref_id, $a_user_id)
403  {
404  global $tree, $lng, $ilBench;
405  //echo "treeCheck<br/>";
406 
407  // Get stored result
408  $tree_cache_key = $a_user_id.':'.$a_ref_id;
409  if (array_key_exists($tree_cache_key, $this->obj_tree_cache)) {
410  // Store access result
411  if (!$this->obj_tree_cache[$tree_cache_key])
412  {
413  $this->current_info->addInfoItem(IL_NO_PERMISSION, $lng->txt("status_no_permission"));
414  }
415  $this->storeAccessResult($a_permission, $a_cmd, $a_ref_id, $this->obj_tree_cache[$tree_cache_key], $a_user_id);
416 
417  return $this->obj_tree_cache[$tree_cache_key];
418  }
419 
420  $ilBench->start("AccessControl", "2000_checkAccess_in_tree");
421 
422  if(!$tree->isInTree($a_ref_id) or $tree->isDeleted($a_ref_id))
423  {
424  // Store negative access results
425 
426  // Store in tree cache
427  // Note, we only store up to 1000 results to avoid memory overflow.
428  if (count($this->obj_tree_cache) < 1000)
429  {
430  $this->obj_tree_cache[$tree_cache_key] = false;
431  }
432 
433  // Store in result cache
434  $this->current_info->addInfoItem(IL_DELETED, $lng->txt("object_deleted"));
435  $this->storeAccessResult($a_permission, $a_cmd, $a_ref_id, false, $a_user_id);
436 
437  $ilBench->stop("AccessControl", "2000_checkAccess_in_tree");
438 
439  return false;
440  }
441 
442  // Store positive access result.
443 
444  // Store in tree cache
445  // Note, we only store up to 1000 results to avoid memory overflow.
446  if (count($this->obj_tree_cache) < 1000)
447  {
448  $this->obj_tree_cache[$tree_cache_key] = true;
449  }
450 
451  // Store in result cache
452  $this->storeAccessResult($a_permission, $a_cmd, $a_ref_id, true, $a_user_id);
453 
454  $ilBench->stop("AccessControl", "2000_checkAccess_in_tree");
455  return true;
456  }
457 
462  function doRBACCheck($a_permission, $a_cmd, $a_ref_id, $a_user_id, $a_type)
463  {
464  global $lng, $ilBench, $ilErr, $ilLog;
465 
466  $ilBench->start("AccessControl", "2500_checkAccess_rbac_check");
467 
468  if ($a_permission == "")
469  {
470  $message = sprintf('%s::doRBACCheck(): No operations given! $a_ref_id: %s',
471  get_class($this),
472  $a_ref_id);
473  $ilLog->write($message,$ilLog->FATAL);
474  $ilErr->raiseError($message,$ilErr->MESSAGE);
475  }
476 
477  if (isset($this->stored_rbac_access[$a_user_id."-".$a_permission."-".$a_ref_id]))
478  {
479  $access = $this->stored_rbac_access[$a_user_id."-".$a_permission."-".$a_ref_id];
480  }
481  else
482  {
483  $access = $this->rbacsystem->checkAccessOfUser($a_user_id, $a_permission, $a_ref_id, $a_type);
484  if (!is_array($this->stored_rbac_access) || count($this->stored_rbac_access) < 1000)
485  {
486  if ($a_permission != "create")
487  {
488  $this->stored_rbac_access[$a_user_id."-".$a_permission."-".$a_ref_id] = $access;
489  }
490  }
491  }
492 
493  // Store in result cache
494  if (!$access)
495  {
496  $this->current_info->addInfoItem(IL_NO_PERMISSION, $lng->txt("status_no_permission"));
497  }
498  if ($a_permission != "create")
499  {
500  $this->storeAccessResult($a_permission, $a_cmd, $a_ref_id, true, $a_user_id);
501  }
502  $ilBench->stop("AccessControl", "2500_checkAccess_rbac_check");
503 
504  return $access;
505  }
506 
511  function doPathCheck($a_permission, $a_cmd, $a_ref_id, $a_user_id, $a_all = false)
512  {
513  global $tree, $lng, $ilBench,$ilObjDataCache;
514 //echo "<br>dopathcheck";
515  //echo "pathCheck<br/>";
516  $ilBench->start("AccessControl", "3100_checkAccess_check_parents_get_path");
517 
518 // if (isset($this->stored_path[$a_ref_id]))
519 // {
520 // $path = $this->stored_path[$a_ref_id];
521 // }
522 // else
523 // {
524  $path = $tree->getPathId($a_ref_id);
525 // $this->stored_path[$a_ref_id] = $path;
526 // }
527  $ilBench->stop("AccessControl", "3100_checkAccess_check_parents_get_path");
528 
529  foreach ($path as $id)
530  {
531  if ($a_ref_id == $id)
532  {
533  continue;
534  }
535 
536  // Check course activation
537  if($ilObjDataCache->lookupType($ilObjDataCache->lookupObjId($id)) == 'crs')
538  {
539  if(!$this->doActivationCheck($a_permission,$a_cmd,$a_ref_id,$a_user_id,$a_all))
540  {
541  return false;
542  }
543  }
544 
545  $access = $this->checkAccessOfUser($a_user_id, "read", "info", $id);
546 
547  if ($access == false)
548  {
549 
550  //$this->doCacheCheck($a_permission, $a_cmd, $a_ref_id, $a_user_id);
551  $this->current_info->addInfoItem(IL_NO_PARENT_ACCESS, $lng->txt("no_parent_access"),$id);
552 
553  if ($a_all == false)
554  {
555  return false;
556  }
557  }
558  }
559 
560  return true;
561  }
562 
567  function doActivationCheck($a_permission, $a_cmd, $a_ref_id, $a_user_id, $a_all = false)
568  {
569  global $ilBench,$ilObjDataCache;
570 
571  $ilBench->start("AccessControl", "3150_checkAccess_check_course_activation");
572 
573  $cache_perm = ($a_permission == "visible")
574  ? "visible"
575  : "other";
576 
577 //echo "<br>doActivationCheck-$cache_perm-$a_ref_id-$a_user_id-".$ilObjDataCache->lookupType($ilObjDataCache->lookupObjId($a_ref_id));
578 
579  if (isset($this->ac_cache[$cache_perm][$a_ref_id][$a_user_id]))
580  {
581  $ilBench->stop("AccessControl", "3150_checkAccess_check_course_activation");
582  return $this->ac_cache[$cache_perm][$a_ref_id][$a_user_id];
583  }
584 
585  // nothings needs to be done if current permission is write permission
586  if($a_permission == 'write')
587  {
588  $ilBench->stop("AccessControl", "3150_checkAccess_check_course_activation");
589  return true;
590  }
591  include_once 'Modules/Course/classes/class.ilCourseItems.php';
592 
593  $this->preloadActivationTimes(array($a_ref_id));
594  if(isset($this->ac_times[$a_ref_id]))
595  {
596  // read preloaded
597  $item_data = $this->ac_times[$a_ref_id];
598  }
599  else
600  {
601  global $ilLog;
602  $ilLog->write(__METHOD__.': Error preloading activation times failed.');
603  $item_data = ilCourseItems::_readActivationTimes(array($a_ref_id));
604  $item_data = $item_data[$a_ref_id];
605  }
606 
607 
608  // if activation isn't enabled
609  if($item_data['timing_type'] != IL_CRS_TIMINGS_ACTIVATION)
610  {
611  $this->ac_cache[$cache_perm][$a_ref_id][$a_user_id] = true;
612  $ilBench->stop("AccessControl", "3150_checkAccess_check_course_activation");
613  return true;
614  }
615 
616  // if within activation time
617  if((time() >= $item_data['timing_start']) and
618  (time() <= $item_data['timing_end']))
619  {
620  $this->ac_cache[$cache_perm][$a_ref_id][$a_user_id] = true;
621  $ilBench->stop("AccessControl", "3150_checkAccess_check_course_activation");
622  return true;
623  }
624 
625  // if user has write permission
626  if($this->checkAccessOfUser($a_user_id, "write", "", $a_ref_id))
627  {
628  $this->ac_cache[$cache_perm][$a_ref_id][$a_user_id] = true;
629  $ilBench->stop("AccessControl", "3150_checkAccess_check_course_activation");
630  return true;
631  }
632  // if current permission is visible and visible is set in activation
633  if($a_permission == 'visible' and $item_data['visible'])
634  {
635  $this->ac_cache[$cache_perm][$a_ref_id][$a_user_id] = true;
636  $ilBench->stop("AccessControl", "3150_checkAccess_check_course_activation");
637  return true;
638  }
639  // no access
640  $this->ac_cache[$cache_perm][$a_ref_id][$a_user_id] = false;
641  $ilBench->stop("AccessControl", "3150_checkAccess_check_course_activation");
642  return false;
643  }
644 
653  public function preloadActivationTimes($a_ref_ids)
654  {
655  include_once('Modules/Course/classes/class.ilCourseItems.php');
656 
657  $read_arr = array();
658  foreach($a_ref_ids as $ref_id)
659  {
660  if(!isset($this->ac_times[$ref_id]))
661  {
662  $read_arr[] = $ref_id;
663  }
664  }
665  if(count($read_arr))
666  {
667  $this->ac_times = (array) $this->ac_times + ilCourseItems::_readActivationTimes($read_arr);
668  }
669  }
670 
675  function doConditionCheck($a_permission, $a_cmd, $a_ref_id,$a_user_id, $a_obj_id, $a_type)
676  {
677  //echo "conditionCheck<br/>";
678  global $lng, $ilBench;
679 
680  if (($a_permission == "read" or $a_permission == 'join') &&
681  !$this->checkAccessOfUser($a_user_id, "write", "", $a_ref_id, $a_type, $a_obj_id))
682  {
683  $ilBench->start("AccessControl", "4000_checkAccess_condition_check");
684  if(!ilConditionHandler::_checkAllConditionsOfTarget($a_ref_id,$a_obj_id,$a_type,$a_user_id))
685  {
686  $conditions = ilConditionHandler::_getConditionsOfTarget($a_ref_id,$a_obj_id, $a_type);
687  foreach ($conditions as $condition)
688  {
689  $this->current_info->addInfoItem(IL_MISSING_PRECONDITION,
690  $lng->txt("missing_precondition").": ".
691  ilObject::_lookupTitle($condition["trigger_obj_id"])." ".
692  $lng->txt("condition_".$condition["operator"])." ".
693  $condition["value"], $condition);
694  }
695  $ilBench->stop("AccessControl", "4000_checkAccess_condition_check");
696  return false;
697  }
698  $ilBench->stop("AccessControl", "4000_checkAccess_condition_check");
699  }
700 
701  return true;
702  }
703 
708  function doStatusCheck($a_permission, $a_cmd, $a_ref_id,$a_user_id, $a_obj_id, $a_type)
709  {
710  global $objDefinition, $ilBench, $ilPluginAdmin;
711  //echo "statusCheck<br/>";
712  $ilBench->start("AccessControl", "5000_checkAccess_object_check");
713 
714  // check for a deactivated plugin
715  if ($objDefinition->isPluginTypeName($a_type) && !$objDefinition->isPlugin($a_type))
716  {
717  return false;
718  }
719 
720  $class = $objDefinition->getClassName($a_type);
721  $location = $objDefinition->getLocation($a_type);
722  $full_class = "ilObj".$class."Access";
723  include_once($location."/class.".$full_class.".php");
724  // static call to ilObj..::_checkAccess($a_cmd, $a_permission, $a_ref_id, $a_obj_id)
725 
726  $ilBench->start("AccessControl", "5001_checkAccess_".$full_class."_check");
727  $obj_access = call_user_func(array($full_class, "_checkAccess"),
728  $a_cmd, $a_permission, $a_ref_id, $a_obj_id, $a_user_id);
729  $ilBench->stop("AccessControl", "5001_checkAccess_".$full_class."_check");
730  if (!($obj_access === true))
731  {
732  //Note: We must not add an info item here, because one is going
733  // to be added by the user function we just called a few
734  // lines above.
735  //$this->current_info->addInfoItem(IL_NO_OBJECT_ACCESS, $obj_access);
736 
737  $this->storeAccessResult($a_permission, $a_cmd, $a_ref_id, false, $a_user_id);
738  $ilBench->stop("AccessControl", "5000_checkAccess_object_check");
739  return false;
740  }
741 
742  $this->storeAccessResult($a_permission, $a_cmd, $a_ref_id, true, $a_user_id);
743  $ilBench->stop("AccessControl", "5000_checkAccess_object_check");
744  return true;
745  }
746 
750  function doLicenseCheck($a_permission, $a_cmd, $a_ref_id,$a_user_id, $a_obj_id, $a_type)
751  {
752  global $lng;
753 
754  // simple checks first
755  if (!in_array($a_type, array('sahs','htlm'))
756  or !in_array($a_permission, array('read')))
757  {
758  $has_access = true;
759  }
760  else
761  {
762  require_once("Services/License/classes/class.ilLicenseAccess.php");
763 
764  // licensing globally disabled => access granted
766  {
767  $has_access = true;
768  }
769  /* resolved mantis issue #5288:
770  * admins should not automatically have read access!
771  * their read access will also be noted and consume a license
772  elseif ($this->rbacsystem->checkAccessOfUser($a_user_id, "edit_permissions", $a_ref_id))
773  {
774  $has_access = true;
775  }
776  */
777  // now do the real check
778  else
779  {
780  $has_access = ilLicenseAccess::_checkAccess($a_user_id, $a_obj_id);
781  }
782  }
783 
784  if ($has_access)
785  {
786  $this->storeAccessResult($a_permission, $a_cmd, $a_ref_id, true, $a_user_id);
787  return true;
788  }
789  else
790  {
791  $this->current_info->addInfoItem(IL_NO_LICENSE, $lng->txt("no_license_available"));
792  $this->storeAccessResult($a_permission, $a_cmd, $a_ref_id, false, $a_user_id);
793  return false;
794  }
795  }
796 
797  function clear()
798  {
799  $this->results = array();
800  $this->last_result = "";
801  $this->current_info = new ilAccessInfo();
802  }
803 
804  function enable($a_str,$a_bool)
805  {
806  $this->$a_str = $a_bool;
807  }
808 }