Esempio n. 1
0
 /**
  * Check, if a user can access an object by license
  *
  * The user can access, if he/she already accessed the object
  * or if a license is available for the object.
  * This check is called from the ilAccessHandler class.
  *
  * @access   static
  * @param    int     	user id
  * @param    int     	object id (not reference)
  * @return   boolean     access is possible (true/false)
  */
 function _checkAccess($a_usr_id, $a_obj_id)
 {
     // Implementation moved
     require_once "Services/License/classes/class.ilLicenseAccess.php";
     return ilLicenseAccess::_checkAccess($a_usr_id, $a_obj_id);
 }
 /**
  * check for available licenses
  */
 function doLicenseCheck($a_permission, $a_cmd, $a_ref_id, $a_user_id, $a_obj_id, $a_type)
 {
     global $lng;
     // simple checks first
     if (!in_array($a_type, array('sahs', 'htlm')) or !in_array($a_permission, array('read'))) {
         $has_access = true;
     } else {
         require_once "Services/License/classes/class.ilLicenseAccess.php";
         // licensing globally disabled => access granted
         if (!ilLicenseAccess::_isEnabled()) {
             $has_access = true;
         } else {
             $has_access = ilLicenseAccess::_checkAccess($a_user_id, $a_obj_id);
         }
     }
     if ($has_access) {
         $this->storeAccessResult($a_permission, $a_cmd, $a_ref_id, true, $a_user_id);
         return true;
     } else {
         $this->current_info->addInfoItem(IL_NO_LICENSE, $lng->txt("no_license_available"));
         $this->storeAccessResult($a_permission, $a_cmd, $a_ref_id, false, $a_user_id);
         return false;
     }
 }