ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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 ()
 
 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 49 of file class.ilWebAccessCheckerDelivery.php.

50 {
51 $this->ilWebAccessChecker = new ilWebAccessChecker($httpState, $cookieFactory);
52 $this->http = $httpState;
53 }
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 174 of file class.ilWebAccessCheckerDelivery.php.

175 {
176 if (!$this->ilWebAccessChecker->isChecked()) {
178 }
179
180 $ilFileDelivery = new Delivery($this->ilWebAccessChecker->getPathObject()->getCleanURLdecodedPath(), $this->http);
181 $ilFileDelivery->setCache(true);
182 $ilFileDelivery->setDisposition($this->ilWebAccessChecker->getDisposition());
183 if ($this->ilWebAccessChecker->getPathObject()->isStreamable()) { // fixed 0016468
184 $ilFileDelivery->stream();
185 } else {
186 $ilFileDelivery->deliver();
187 }
188 }
Class ilWACException.

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 110 of file class.ilWebAccessCheckerDelivery.php.

111 {
112 $ilFileDelivery = new Delivery('./Services/WebAccessChecker/templates/images/access_denied.png', $this->http);
113 $ilFileDelivery->setDisposition($this->ilWebAccessChecker->getDisposition());
114 $ilFileDelivery->deliver();
115 }

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 118 of file class.ilWebAccessCheckerDelivery.php.

119 {
120 $ilFileDelivery = new Delivery('./Services/WebAccessChecker/templates/images/access_denied.mp4', $this->http);
121 $ilFileDelivery->setDisposition($this->ilWebAccessChecker->getDisposition());
122 $ilFileDelivery->stream();
123 }

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 101 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 129 of file class.ilWebAccessCheckerDelivery.php.

130 {
131
132 //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)
133 $response = $this->http
134 ->response()
135 ->withStatus(200);
136
137 $this->http->saveResponse($response);
138
139 if ($this->ilWebAccessChecker->getPathObject()->isImage()) {
140 $this->deliverDummyImage();
141 }
142 if ($this->ilWebAccessChecker->getPathObject()->isVideo()) {
143 $this->deliverDummyVideo();
144 }
145
147 }
$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:

◆ handleRequest()

ilWebAccessCheckerDelivery::handleRequest ( )
protected
Returns
void

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

60 {
61 // Set errorreporting
63 $queries = $this->http->request()->getQueryParams();
64
65 // Set customizing
66 if (isset($queries[ilWebAccessChecker::DISPOSITION])) {
68 }
69 if (isset($queries[ilWebAccessChecker::STATUS_CODE])) {
71 }
72 if (isset($queries[ilWebAccessChecker::REVALIDATE])) {
74 }
75
76 // Check if File can be delivered
77 try {
78 if ($this->ilWebAccessChecker->check()) {
79 $this->deliver();
80 } else {
81 $this->deny();
82 }
83 } catch (ilWACException $e) {
84 switch ($e->getCode()) {
88 $this->handleAccessErrors($e);
89 break;
93 default:
94 $this->handleErrors($e);
95 break;
96 }
97 }
98 }
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(), ILIAS\FileDelivery\http(), ilWACException\INITIALISATION_FAILED, ilWACException\NO_CHECKING_INSTANCE, 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 36 of file class.ilWebAccessCheckerDelivery.php.

37 {
38 $obj = new self($httpState, $cookieFactory);
39 $obj->handleRequest();
40 }

Field Documentation

◆ $http

GlobalHttpState ilWebAccessCheckerDelivery::$http
private

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

◆ $ilWebAccessChecker

ilWebAccessCheckerDelivery::$ilWebAccessChecker = null
private

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


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