ILIAS  release_7 Revision v7.30-3-g800a261c036
ilWebAccessCheckerDelivery Class Reference

Class ilWebAccessCheckerDelivery. More...

+ Collaboration diagram for ilWebAccessCheckerDelivery:

Public Member Functions

 __construct (GlobalHttpState $httpState, CookieFactory $cookieFactory)
 ilWebAccessCheckerDelivery constructor. More...
 

Static Public Member Functions

static run (GlobalHttpState $httpState, CookieFactory $cookieFactory)
 

Protected Member Functions

 handleRequest ()
 
 deny ()
 
 deliverDummyImage ()
 
 deliverDummyVideo ()
 
 handleNotFoundError (ilWACException $e)
 
 handleAccessErrors (ilWACException $e)
 
 deliver ()
 

Private Attributes

 $ilWebAccessChecker = null
 
 $http
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilWebAccessCheckerDelivery::__construct ( GlobalHttpState  $httpState,
CookieFactory  $cookieFactory 
)

ilWebAccessCheckerDelivery constructor.

Parameters
GlobalHttpState$httpState
CookieFactory$cookieFactory

Definition at line 64 of file class.ilWebAccessCheckerDelivery.php.

65 {
66 $this->ilWebAccessChecker = new ilWebAccessChecker($httpState, $cookieFactory);
67 $this->http = $httpState;
68 }
Class ilWebAccessChecker.
static http()
Fetches the global http state from ILIAS.

References ILIAS\FileDelivery\http().

+ Here is the call graph for this function:

Member Function Documentation

◆ deliver()

ilWebAccessCheckerDelivery::deliver ( )
protected
Returns
void
Exceptions
ilWACException

Definition at line 199 of file class.ilWebAccessCheckerDelivery.php.

200 {
201 if (!$this->ilWebAccessChecker->isChecked()) {
203 }
204
205 $ilFileDelivery = new Delivery($this->ilWebAccessChecker->getPathObject()->getCleanURLdecodedPath(), $this->http);
206 $ilFileDelivery->setCache(true);
207 $ilFileDelivery->setDisposition($this->ilWebAccessChecker->getDisposition());
208 if ($this->ilWebAccessChecker->getPathObject()->isStreamable()) { // fixed 0016468
209 $ilFileDelivery->stream();
210 } else {
211 $ilFileDelivery->deliver();
212 }
213 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References ilWACException\ACCESS_WITHOUT_CHECK, ilWebAccessChecker\getDisposition(), ilWebAccessChecker\getPathObject(), and ilWebAccessChecker\isChecked().

Referenced by handleRequest().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deliverDummyImage()

ilWebAccessCheckerDelivery::deliverDummyImage ( )
protected

Definition at line 128 of file class.ilWebAccessCheckerDelivery.php.

129 {
130 $ilFileDelivery = new Delivery('./Services/WebAccessChecker/templates/images/access_denied.png', $this->http);
131 $ilFileDelivery->setDisposition($this->ilWebAccessChecker->getDisposition());
132 $ilFileDelivery->deliver();
133 }

References ilWebAccessChecker\getDisposition(), and ILIAS\FileDelivery\http().

Referenced by handleAccessErrors().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deliverDummyVideo()

ilWebAccessCheckerDelivery::deliverDummyVideo ( )
protected

Definition at line 136 of file class.ilWebAccessCheckerDelivery.php.

137 {
138 $ilFileDelivery = new Delivery('./Services/WebAccessChecker/templates/images/access_denied.mp4', $this->http);
139 $ilFileDelivery->setDisposition($this->ilWebAccessChecker->getDisposition());
140 $ilFileDelivery->stream();
141 }

References ilWebAccessChecker\getDisposition(), and ILIAS\FileDelivery\http().

Referenced by handleAccessErrors().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deny()

ilWebAccessCheckerDelivery::deny ( )
protected

Definition at line 119 of file class.ilWebAccessCheckerDelivery.php.

References ilWACException\ACCESS_DENIED, ilWACException\ACCESS_WITHOUT_CHECK, and ilWebAccessChecker\isChecked().

Referenced by handleRequest().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleAccessErrors()

ilWebAccessCheckerDelivery::handleAccessErrors ( ilWACException  $e)
protected
Parameters
ilWACException$e

Definition at line 155 of file class.ilWebAccessCheckerDelivery.php.

156 {
157
158 //1.5.2017 Http code needs to be 200 because mod_xsendfile ignores the response with an 401 code. (possible leak of web path via xsendfile header)
159 $response = $this->http
160 ->response()
161 ->withStatus(200);
162
163 $this->http->saveResponse($response);
164
165 if ($this->ilWebAccessChecker->getPathObject()->isImage()) {
166 $this->deliverDummyImage();
167 }
168 if ($this->ilWebAccessChecker->getPathObject()->isVideo()) {
169 $this->deliverDummyVideo();
170 }
171
173 }
$response

References $response, deliverDummyImage(), deliverDummyVideo(), ilWebAccessChecker\getPathObject(), ILIAS\FileDelivery\http(), and ilWebAccessChecker\initILIAS().

Referenced by handleRequest().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleNotFoundError()

ilWebAccessCheckerDelivery::handleNotFoundError ( ilWACException  $e)
protected

Definition at line 143 of file class.ilWebAccessCheckerDelivery.php.

143 : void
144 {
145 $response = $this->http
146 ->response()
147 ->withStatus(404);
148
149 $this->http->saveResponse($response);
150 }

References $response, and ILIAS\FileDelivery\http().

Referenced by handleRequest().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleRequest()

ilWebAccessCheckerDelivery::handleRequest ( )
protected
Returns
void

Definition at line 74 of file class.ilWebAccessCheckerDelivery.php.

75 {
76 // Set errorreporting
78 $queries = $this->http->request()->getQueryParams();
79
80 // Set customizing
81 if (isset($queries[ilWebAccessChecker::DISPOSITION])) {
83 }
84 if (isset($queries[ilWebAccessChecker::STATUS_CODE])) {
86 }
87 if (isset($queries[ilWebAccessChecker::REVALIDATE])) {
89 }
90
91 // Check if File can be delivered
92 try {
93 if ($this->ilWebAccessChecker->check()) {
94 $this->deliver();
95 } else {
96 $this->deny();
97 }
98 } catch (ilWACException $e) {
99 switch ($e->getCode()) {
101 $this->handleNotFoundError($e);
102 break;
106 $this->handleAccessErrors($e);
107 break;
111 default:
112 $this->handleErrors($e);
113 break;
114 }
115 }
116 }
static handleErrorReporting()
Set error reporting level.
setSendStatusCode($send_status_code)
setRevalidateFolderTokens($revalidate_folder_tokens)

References Vendor\Package\$e, ilWACException\ACCESS_DENIED, ilWACException\ACCESS_DENIED_NO_LOGIN, ilWACException\ACCESS_DENIED_NO_PUB, ilWACException\ACCESS_WITHOUT_CHECK, ilWebAccessChecker\check(), deliver(), deny(), ilWebAccessChecker\DISPOSITION, handleAccessErrors(), ilInitialisation\handleErrorReporting(), handleNotFoundError(), ILIAS\FileDelivery\http(), ilWACException\INITIALISATION_FAILED, ilWACException\NO_CHECKING_INSTANCE, ilWACException\NOT_FOUND, ilWebAccessChecker\REVALIDATE, ilWebAccessChecker\setDisposition(), ilWebAccessChecker\setRevalidateFolderTokens(), ilWebAccessChecker\setSendStatusCode(), and ilWebAccessChecker\STATUS_CODE.

+ Here is the call graph for this function:

◆ run()

static ilWebAccessCheckerDelivery::run ( GlobalHttpState  $httpState,
CookieFactory  $cookieFactory 
)
static
Parameters
GlobalHttpState$httpState
CookieFactory$cookieFactory
Returns
void

Definition at line 51 of file class.ilWebAccessCheckerDelivery.php.

52 {
53 $obj = new self($httpState, $cookieFactory);
54 $obj->handleRequest();
55 }

Field Documentation

◆ $http

GlobalHttpState ilWebAccessCheckerDelivery::$http
private

Definition at line 42 of file class.ilWebAccessCheckerDelivery.php.

◆ $ilWebAccessChecker

ilWebAccessCheckerDelivery::$ilWebAccessChecker = null
private

Definition at line 38 of file class.ilWebAccessCheckerDelivery.php.


The documentation for this class was generated from the following file: