ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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.

References ILIAS\FileDelivery\http().

50  {
51  $this->ilWebAccessChecker = new ilWebAccessChecker($httpState, $cookieFactory);
52  $this->http = $httpState;
53  }
static http()
Fetches the global http state from ILIAS.
Class ilWebAccessChecker.
+ 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.

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

Referenced by handleRequest().

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.
Class ilWebAccessChecker.
+ 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.

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

Referenced by handleAccessErrors().

111  {
112  $ilFileDelivery = new Delivery('./Services/WebAccessChecker/templates/images/access_denied.png', $this->http);
113  $ilFileDelivery->setDisposition($this->ilWebAccessChecker->getDisposition());
114  $ilFileDelivery->deliver();
115  }
static http()
Fetches the global http state from ILIAS.
Class ilWebAccessChecker.
+ 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.

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

Referenced by handleAccessErrors().

119  {
120  $ilFileDelivery = new Delivery('./Services/WebAccessChecker/templates/images/access_denied.mp4', $this->http);
121  $ilFileDelivery->setDisposition($this->ilWebAccessChecker->getDisposition());
122  $ilFileDelivery->stream();
123  }
static http()
Fetches the global http state from ILIAS.
Class ilWebAccessChecker.
+ 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().

102  {
103  if (!$this->ilWebAccessChecker->isChecked()) {
105  }
107  }
Class ilWACException.
Class ilWebAccessChecker.
+ 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.

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

Referenced by handleRequest().

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 
146  $this->ilWebAccessChecker->initILIAS();
147  }
static http()
Fetches the global http state from ILIAS.
Class ilWebAccessChecker.
$response
+ 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.

References 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.

60  {
61  // Set errorreporting
63  $queries = $this->http->request()->getQueryParams();
64 
65  // Set customizing
66  if (isset($queries[ilWebAccessChecker::DISPOSITION])) {
67  $this->ilWebAccessChecker->setDisposition($queries[ilWebAccessChecker::DISPOSITION]);
68  }
69  if (isset($queries[ilWebAccessChecker::STATUS_CODE])) {
70  $this->ilWebAccessChecker->setSendStatusCode($queries[ilWebAccessChecker::STATUS_CODE]);
71  }
72  if (isset($queries[ilWebAccessChecker::REVALIDATE])) {
73  $this->ilWebAccessChecker->setRevalidateFolderTokens($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  }
Class ilWACException.
setRevalidateFolderTokens($revalidate_folder_tokens)
static http()
Fetches the global http state from ILIAS.
Class ilWebAccessChecker.
setSendStatusCode($send_status_code)
static handleErrorReporting()
Set error reporting level.
+ 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.

Referenced by ilWACCheckingInstanceTest\setUp().

37  {
38  $obj = new self($httpState, $cookieFactory);
39  $obj->handleRequest();
40  }
+ Here is the caller graph for this function:

Field Documentation

◆ $http

GlobalHttpState ilWebAccessCheckerDelivery::$http
private

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

Referenced by deliver().

◆ $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: