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

Method indexPublicMin

lib/Controller/PageController.php:218–243  ·  view source on GitHub ↗

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

($token)

Source from the content-addressed store, hash-verified

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 {

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