ILIAS  trunk Revision v12.0_alpha-1540-g00f839d5fa1
StaticUrlHandler.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
29
30class StaticUrlHandler extends BaseHandler implements Handler
31{
32 public const string NAMESPACE = 'assistant';
33
34 public function getNamespace(): string
35 {
36 return self::NAMESPACE;
37 }
38
39 public function handle(Request $request, Context $context, Factory $response_factory): Response
40 {
41 $settings = new \ilSetting();
42 if (!$settings->get('password_assistance', '0')) {
43 return $response_factory->cannot();
44 }
45
46 $path = implode('/', $request->getAdditionalParameters() ?? []);
47
48 return match ($path) {
49 'password' => $response_factory->can(
50 $context->ctrl()->getLinkTargetByClass(
51 [
52 \ilStartUpGUI::class,
53 \ilPasswordAssistanceGUI::class
54 ]
55 )
56 ),
57 'username' => $response_factory->can(
58 $context->ctrl()->getLinkTargetByClass(
59 [
60 \ilStartUpGUI::class,
61 \ilPasswordAssistanceGUI::class
62 ],
63 'showUsernameAssistanceForm'
64 )
65 ),
66 default => $response_factory->cannot(),
67 };
68 }
69}
handle(Request $request, Context $context, Factory $response_factory)
can(string $uri_path, bool $shift=false)
The Handler successfully resolved the target.
Definition: Factory.php:88
cannot()
The Handler cannot process the given Request at all, e.g.
Definition: Factory.php:47
$path
Definition: ltiservices.php:30