20
20
21
21
namespace ILIAS \StaticURL \Handler ;
22
22
23
+ use ILIAS \StaticURL \Request \Request ;
23
24
use ILIAS \StaticURL \Request \RequestBuilder ;
24
25
use ILIAS \Data \URI ;
25
26
use ILIAS \StaticURL \Response \Factory ;
26
27
use ILIAS \StaticURL \Context ;
27
28
use ILIAS \StaticURL \Builder \StandardURIBuilder ;
29
+ use ILIAS \StaticURL \Response \MaybeCanHandlerAfterLogin ;
28
30
29
31
/**
30
32
* @author Fabian Schmid <[email protected] >
@@ -48,7 +50,10 @@ public function __construct(
48
50
}
49
51
}
50
52
51
- public function performRedirect (URI $ base_uri ): never
53
+ /**
54
+ * @return never
55
+ */
56
+ public function performRedirect (URI $ base_uri ): void
52
57
{
53
58
$ http = $ this ->context ->http ();
54
59
$ ctrl = $ this ->context ->refinery ();
@@ -58,12 +63,12 @@ public function performRedirect(URI $base_uri): never
58
63
$ this ->context ->refinery (),
59
64
$ this ->handlers
60
65
);
61
- if (!$ request instanceof \ ILIAS \ StaticURL \ Request \ Request) {
66
+ if (!$ request instanceof Request) {
62
67
throw new \RuntimeException ('No request could be built ' );
63
68
}
64
69
65
70
$ handler = $ this ->handlers [$ request ->getNamespace ()] ?? null ;
66
- if (!$ handler instanceof \ ILIAS \ StaticURL \ Handler \ Handler) {
71
+ if (!$ handler instanceof Handler) {
67
72
throw new \InvalidArgumentException ('No handler found for namespace ' . $ request ->getNamespace ());
68
73
}
69
74
$ response = $ handler ->handle ($ request , $ this ->context , $ this ->response_factory );
@@ -74,7 +79,10 @@ public function performRedirect(URI $base_uri): never
74
79
}
75
80
76
81
// Check access to target
77
- if (!$ this ->context ->isUserLoggedIn () && !$ this ->context ->isPublicSectionActive ()) {
82
+ if (
83
+ $ response instanceof MaybeCanHandlerAfterLogin
84
+ || (!$ this ->context ->isUserLoggedIn () && !$ this ->context ->isPublicSectionActive ())
85
+ ) {
78
86
$ uri_builder = new StandardURIBuilder (ILIAS_HTTP_PATH , false );
79
87
$ target = $ uri_builder ->buildTarget (
80
88
$ request ->getNamespace (),
@@ -88,7 +96,7 @@ public function performRedirect(URI $base_uri): never
88
96
} else {
89
97
// Perform Redirect
90
98
$ uri_path = $ response ->getURIPath ();
91
- $ full_uri = $ base_uri . '/ ' . trim ($ uri_path , '/ ' );
99
+ $ full_uri = $ base_uri . '/ ' . trim (( string ) $ uri_path , '/ ' );
92
100
}
93
101
94
102
$ http ->saveResponse (
@@ -105,7 +113,7 @@ public function performRedirect(URI $base_uri): never
105
113
private function appendUnknownParameters (Context $ context , string $ full_uri ): string
106
114
{
107
115
if ($ context ->http ()->wrapper ()->query ()->has ('soap_pw ' )) {
108
- $ full_uri = \ilUtil::appendUrlParameterString (
116
+ return \ilUtil::appendUrlParameterString (
109
117
$ full_uri ,
110
118
'soap_pw= ' . $ context ->http ()->wrapper ()->query ()->retrieve (
111
119
'soap_pw ' ,
@@ -114,7 +122,7 @@ private function appendUnknownParameters(Context $context, string $full_uri): st
114
122
);
115
123
}
116
124
if ($ context ->http ()->wrapper ()->query ()->has ('ext_uid ' )) {
117
- $ full_uri = ilUtil::appendUrlParameterString (
125
+ return ilUtil::appendUrlParameterString (
118
126
$ full_uri ,
119
127
'ext_uid= ' . $ context ->http ()->wrapper ()->query ()->retrieve (
120
128
'ext_uid ' ,
0 commit comments