19declare(strict_types=1);
55 return $this->delivery;
60 return $this->legacy_delivery;
66 Disposition $disposition,
68 int $valid_for_at_least_hours
70 $token = $this->data_signer->getSignedStreamToken(
87 Disposition $disposition,
89 int $valid_for_at_least_hours
91 $token = $this->data_signer->getSignedStreamTokenWithoutIsolation(
96 $this->validUntil($valid_for_at_least_hours)
102 private function validUntil(
int $valid_for_at_least_hours): \DateTimeImmutable
105 $valid_for_at_least_hours++;
106 return new \DateTimeImmutable(
107 (
new \DateTimeImmutable(
"now +$valid_for_at_least_hours hours"))->format(
'Y-m-d H:00')
117 if (isset($pathinfo[
'extension']) && $pathinfo[
'extension'] !==
'') {
118 $suffix =
'.' . $pathinfo[
'extension'];
122 $this->getBaseURI($isolated) . self::DELIVERY_ENDPOINT .
$token . $suffix
128 return $this->base_uris[$isolated ?
'content' :
'ilias'] ??= $this->buildBaseURI($isolated);
133 $request_uri = $this->
http->request()->getUri();
134 $http_path = $this->http_path?->getHttpPath();
138 $is_without_request = $request_uri->getHost() ===
'';
142 $path = match (
true) {
143 $http_path !==
null => rtrim(
'/' . ($http_path->getPath() ??
''),
'/'),
144 $is_without_request =>
'',
145 default => rtrim(dirname($request_uri->getPath()),
'/'),
149 && $this->isolation->isActivated()
150 && ($content_domain = $this->isolation->getContentDomain()) !==
null
152 return rtrim($content_domain,
'/') . $path;
155 if ($is_without_request) {
156 return $http_path?->getBaseURI() ??
'';
161 $request_uri->getScheme()
162 .
'://' . $request_uri->getHost()
163 . ($request_uri->getPort() ?
':' . $request_uri->getPort() :
'')
The scope of this class is split ilias-conform URI's into components.
Read-only configuration of the IRSS User Content Isolation feature.
buildTokenURL(FileStream $stream, string $filename, Disposition $disposition, int $user_id, int $valid_for_at_least_hours)
buildTokenURLWithoutIsolation(FileStream $stream, string $filename, Disposition $disposition, int $user_id, int $valid_for_at_least_hours)
buildURL(string $token, string $filename, bool $isolated)
__construct(private StreamDelivery $delivery, private LegacyDelivery $legacy_delivery, private DataSigning $data_signer, private GlobalHttpState $http, private IsolationConfig $isolation=new IsolationConfig(false, null, null), private ?HttpPathProvider $http_path=null)
getBaseURI(bool $isolated=true)
buildBaseURI(bool $isolated)
validUntil(int $valid_for_at_least_hours)
The base interface for all filesystem streams.
Interface GlobalHttpState.
Tells under which URL this ILIAS installation is reached, e.g.
readonly HttpService $http
static http()
Fetches the global http state from ILIAS.