* @param $token * @param string $password * @return TemplateResponse|RedirectResponse */
($token)
| 216 | * @return TemplateResponse|RedirectResponse |
| 217 | */ |
| 218 | #[PublicPage] |
| 219 | #[UseSession] |
| 220 | #[NoCSRFRequired] |
| 221 | public function indexPublicMin($token) |
| 222 | { |
| 223 | $share = $this->ShareService->getReportByToken($token); |
| 224 | |
| 225 | if (empty($share)) { |
| 226 | // Dataset not shared or wrong token |
| 227 | return $this->redirectToLogin($token); |
| 228 | } else { |
| 229 | if (!$this->hasShareAccess($token, $share)) { |
| 230 | return $this->passwordPrompt($token, false); |
| 231 | } |
| 232 | $params = array(); |
| 233 | $params['data'] = $this->outputController->getData($share); |
| 234 | $params['baseurl'] = str_replace('/img/app.svg', '', $this->urlGenerator->imagePath('analytics', 'app.svg')); |
| 235 | $params['nonce'] = \OC::$server->getContentSecurityPolicyNonceManager()->getNonce(); |
| 236 | $response = new StandaloneTemplateResponse($this->appName, 'publicMin', $params, ''); |
| 237 | $csp = new ContentSecurityPolicy(); |
| 238 | $csp->addAllowedScriptDomain('*'); |
| 239 | $csp->addAllowedFrameAncestorDomain($share['domain']); |
| 240 | $response->setContentSecurityPolicy($csp); |
| 241 | return $response; |
| 242 | } |
| 243 | } |
| 244 | |
| 245 | private function hasShareAccess(string $token, array $share): bool |
| 246 | { |
nothing calls this directly
no test coverage detected