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

Method readPublic

lib/Controller/OutputController.php:339–357  ·  view source on GitHub ↗

* get the data when requested from public page * * @param $token * @param $filteroptions * @param $dataoptions * @param $chartoptions * @param $tableoptions * @return DataResponse|NotFoundResponse * @throws Exception */

($token, $filteroptions, $dataoptions, $chartoptions, $tableoptions)

Source from the content-addressed store, hash-verified

337 * @throws Exception
338 */
339 #[NoAdminRequired]
340 #[UseSession]
341 #[PublicPage]
342 public function readPublic($token, $filteroptions, $dataoptions, $chartoptions, $tableoptions) {
343 $share = $this->ShareService->getReportByToken($token);
344 if (empty($share)) {
345 // Dataset not shared or wrong token
346 return new NotFoundResponse();
347 } else {
348 if ($share['password'] !== null) {
349 if (!$this->DataSession->isShareAuthenticated($token, $share['password'])) {
350 return new NotFoundResponse();
351 }
352 }
353 $share = $this->evaluateCanFilter($share, $filteroptions, $dataoptions, $chartoptions, $tableoptions);
354 $result = $this->getData($share);
355 return new DataResponse($result, HTTP::STATUS_OK);
356 }
357 }
358
359 /**
360 * evaluate if the user did filter in the report and if he is allowed to filter (shared reports)

Callers

nothing calls this directly

Calls 4

evaluateCanFilterMethod · 0.95
getDataMethod · 0.95
isShareAuthenticatedMethod · 0.80
getReportByTokenMethod · 0.45

Tested by

no test coverage detected