ILIAS  release_8 Revision v8.24
ilWebAccessCheckerDelivery Class Reference

Class ilWebAccessCheckerDelivery. More...

+ Collaboration diagram for ilWebAccessCheckerDelivery:

Public Member Functions

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

Static Public Member Functions

static run (Services $httpState, CookieFactory $cookieFactory)
 

Protected Member Functions

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

Private Attributes

ilWebAccessChecker $wac
 
Services $http
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

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

ilWebAccessCheckerDelivery constructor.

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

45 {
46 $this->wac = new ilWebAccessChecker($httpState, $cookieFactory);
47 $this->http = $httpState;
48 }
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
Exceptions
ilWACException

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

174 : void
175 {
176 if (!$this->wac->isChecked()) {
178 }
179
180 $ilFileDelivery = new Delivery($this->wac->getPathObject()->getCleanURLdecodedPath(), $this->http);
181 $ilFileDelivery->setCache(true);
182 $ilFileDelivery->setDisposition($this->wac->getDisposition());
183 if ($this->wac->getPathObject()->isStreamable()) { // fixed 0016468
184 $ilFileDelivery->stream();
185 } else {
186 $ilFileDelivery->deliver();
187 }
188 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References ilWACException\ACCESS_WITHOUT_CHECK.

Referenced by handleRequest().

+ Here is the caller graph for this function:

◆ deliverDummyImage()

ilWebAccessCheckerDelivery::deliverDummyImage ( )
protected

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

108 : void
109 {
110 $ilFileDelivery = new Delivery('./Services/WebAccessChecker/templates/images/access_denied.png', $this->http);
111 $ilFileDelivery->setDisposition($this->wac->getDisposition());
112 $ilFileDelivery->deliver();
113 }

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

116 : void
117 {
118 $ilFileDelivery = new Delivery('./Services/WebAccessChecker/templates/images/access_denied.mp4', $this->http);
119 $ilFileDelivery->setDisposition($this->wac->getDisposition());
120 $ilFileDelivery->stream();
121 }

References 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
Exceptions
ilWACException

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

99 : void
100 {
101 if (!$this->wac->isChecked()) {
103 }
105 }

References ilWACException\ACCESS_DENIED, and ilWACException\ACCESS_WITHOUT_CHECK.

Referenced by handleRequest().

+ Here is the caller graph for this function:

◆ handleAccessErrors()

ilWebAccessCheckerDelivery::handleAccessErrors ( ilWACException  $e)
protected

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

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

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

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

123 : void
124 {
125 $response = $this->http
126 ->response()
127 ->withStatus(404);
128
129 $this->http->saveResponse($response);
130 }

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

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

51 : void
52 {
53 // Set errorreporting
55 $queries = $this->http->request()->getQueryParams();
56
57 // Set customizing
58 if (isset($queries[ilWebAccessChecker::DISPOSITION])) {
59 $this->wac->setDisposition($queries[ilWebAccessChecker::DISPOSITION]);
60 }
61 if (isset($queries[ilWebAccessChecker::STATUS_CODE])) {
62 $this->wac->setSendStatusCode($queries[ilWebAccessChecker::STATUS_CODE]);
63 }
64 if (isset($queries[ilWebAccessChecker::REVALIDATE])) {
65 $this->wac->setRevalidateFolderTokens($queries[ilWebAccessChecker::REVALIDATE]);
66 }
67
68 // Check if File can be delivered
69 try {
70 if ($this->wac->check()) {
71 $this->deliver();
72 } else {
73 $this->deny();
74 }
75 } catch (ilWACException $e) {
76 switch ($e->getCode()) {
78 $this->handleNotFoundError($e);
79 break;
83 $this->handleAccessErrors($e);
84 break;
88 default:
89 $this->handleErrors($e);
90 break;
91 }
92
93 }
94 }
static handleErrorReporting()
Set error reporting level.

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

+ Here is the call graph for this function:

◆ run()

static ilWebAccessCheckerDelivery::run ( Services  $httpState,
CookieFactory  $cookieFactory 
)
static

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

34 : void
35 {
36 $obj = new self($httpState, $cookieFactory);
37 $obj->handleRequest();
38 }

Field Documentation

◆ $http

Services ilWebAccessCheckerDelivery::$http
private

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

◆ $wac

ilWebAccessChecker ilWebAccessCheckerDelivery::$wac
private

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


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