24 require_once(
'./Services/WebAccessChecker/classes/class.ilWACSignedPath.php');
25 require_once(
'./Services/WebAccessChecker/classes/class.ilWACPath.php');
26 require_once(
'./Services/WebAccessChecker/classes/class.ilWACSecurePath.php');
27 require_once(
'./Services/Init/classes/class.ilInitialisation.php');
28 require_once(
'./Services/FileDelivery/classes/class.ilFileDelivery.php');
76 $this->ressource_not_found =
$e;
79 $this->
http = $httpState;
91 if ($this->ressource_not_found !== null) {
100 if ($ilWACSignedPath->isSignedPath()) {
102 if ($ilWACSignedPath->isSignedPathValid()) {
111 if ($ilWACSignedPath->isFolderSigned()) {
113 if ($ilWACSignedPath->isFolderTokenValid()) {
115 $ilWACSignedPath->revalidatingFolderToken();
118 $this->
sendHeader(
'checked using secure folder');
129 $clean_path = $this->
getPathObject()->getCleanURLdecodedPath();
130 $path = realpath($clean_path);
132 if (strpos($path, (
string) $data_dir) !== 0) {
135 if (dirname($path) === $data_dir && is_file($path)) {
142 $checkingInstance = ilWACSecurePath::getCheckingInstance($this->
getPathObject());
144 $canBeDelivered = $checkingInstance->canBeDelivered($this->
getPathObject());
145 if ($canBeDelivered) {
148 $ilWACSignedPath->revalidatingFolderToken();
200 $cookie = $this->cookieFactory->create(
'ilClientId', $this->
getPathObject()->getClient())
206 ->renderIntoResponseHeader($this->
http->response());
220 if (($e instanceof
Exception && $e->getMessage() ==
'Authentication failed.')
222 $this->initAnonymousSession();
232 if ($DIC->user()->getId() === 0) {
246 $is_null_user = ($DIC->user()->getId() === 0);
247 $pub_section_activated = (bool) $DIC[
'ilSetting']->
get(
'pub_section');
248 $isset = isset($DIC[
'ilSetting']);
249 $instanceof = $DIC[
'ilSetting'] instanceof
ilSetting;
251 if (!$isset || !$instanceof) {
255 if ($pub_section_activated && ($is_null_user || $is_anonymous)) {
260 if ($is_anonymous || $is_null_user) {
270 $is_user = $DIC->user() instanceof
ilObjUser;
271 $user_id_is_zero = ((int) $DIC->user()->getId() === 0);
272 if (!$is_user || $user_id_is_zero) {
283 return (
bool) $this->checked;
294 assert(is_bool($checked));
295 $this->checked = $checked;
304 return $this->path_object;
315 $this->path_object = $path_object;
324 return (
string) $this->disposition;
335 assert(is_string($disposition));
336 $this->disposition = $disposition;
345 return (
string) $this->override_mimetype;
356 assert(is_string($override_mimetype));
357 $this->override_mimetype = $override_mimetype;
366 return (
bool) $this->initialized;
375 assert(is_bool($initialized));
376 $this->initialized = $initialized;
385 return (
bool) $this->send_status_code;
396 assert(is_bool($send_status_code));
397 $this->send_status_code = $send_status_code;
406 return (
bool) $this->revalidate_folder_tokens;
417 assert(is_bool($revalidate_folder_tokens));
418 $this->revalidate_folder_tokens = $revalidate_folder_tokens;
427 return (
bool) self::$use_seperate_logfile;
438 assert(is_bool($use_seperate_logfile));
439 self::$use_seperate_logfile = $use_seperate_logfile;
470 assert(is_int($method));
471 $this->applied_checking_methods[] = $method;
475 protected function initAnonymousSession()
478 include_once
'./Services/Context/classes/class.ilContext.php';
481 require_once(
"Services/Init/classes/class.ilInitialisation.php");
486 $ilAuthSession = $DIC[
'ilAuthSession'];
487 $ilAuthSession->init();
488 $ilAuthSession->regenerateId();
490 $ilAuthSession->setUserId($a_id);
491 $ilAuthSession->setAuthenticated(
false, $a_id);
492 $DIC->user()->setId($a_id);
setPathObject(ilWACPath $path_object)
static setUseSeperateLogfile($use_seperate_logfile)
Interface GlobalHttpState.
getAppliedCheckingMethods()
request()
Returns the current psr-7 server request.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setInitialized($initialized)
setDisposition($disposition)
setAppliedCheckingMethods(array $applied_checking_methods)
const CM_CHECKINGINSTANCE
const ACCESS_DENIED_NO_LOGIN
setRevalidateFolderTokens($revalidate_folder_tokens)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(GlobalHttpState $httpState, CookieFactory $cookieFactory)
ilWebAccessChecker constructor.
static initILIAS()
ilias initialisation
static http()
Fetches the global http state from ILIAS.
isRevalidateFolderTokens()
Class ilWebAccessChecker.
setSendStatusCode($send_status_code)
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
static isUseSeperateLogfile()
setOverrideMimetype($override_mimetype)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static init($a_type)
Init context by type.
$applied_checking_methods
static hasCheckingInstanceRegistered(ilWACPath $ilWACPath)
Searches a checking instance for the given wac path.
const ACCESS_DENIED_NO_PUB
addAppliedCheckingMethod($method)