MCPcopy Create free account
hub / github.com/Rello/analytics / indexPublicMin

Method indexPublicMin

lib/Controller/PageController.php:232–257  ·  view source on GitHub ↗

* @param $token * @param string $password * @return TemplateResponse|RedirectResponse */

($token)

Source from the content-addressed store, hash-verified

230 * @return TemplateResponse|RedirectResponse
231 */
232 #[PublicPage]
233 #[UseSession]
234 #[NoCSRFRequired]
235 public function indexPublicMin($token)
236 {
237 $share = $this->ShareService->getReportByToken($token);
238
239 if (empty($share)) {
240 // Dataset not shared or wrong token
241 return $this->redirectToLogin($token);
242 } else {
243 if (!$this->hasShareAccess($token, $share)) {
244 return $this->passwordPrompt($token, false);
245 }
246 $params = array();
247 $params['data'] = $this->outputController->getData($share);
248 $params['baseurl'] = str_replace('/img/app.svg', '', $this->urlGenerator->imagePath('analytics', 'app.svg'));
249 $params['nonce'] = \OC::$server->getContentSecurityPolicyNonceManager()->getNonce();
250 $response = new StandaloneTemplateResponse($this->appName, 'publicMin', $params, '');
251 $csp = new ContentSecurityPolicy();
252 $csp->addAllowedScriptDomain('*');
253 $csp->addAllowedFrameAncestorDomain($share['domain']);
254 $response->setContentSecurityPolicy($csp);
255 return $response;
256 }
257 }
258
259 private function hasShareAccess(string $token, array $share): bool
260 {

Callers

nothing calls this directly

Calls 6

redirectToLoginMethod · 0.95
hasShareAccessMethod · 0.95
passwordPromptMethod · 0.95
getReportByTokenMethod · 0.45
getDataMethod · 0.45
imagePathMethod · 0.45

Tested by

no test coverage detected