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

Method readPublic

lib/Controller/OutputController.php:393–411  ·  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, ?string $chart = null, ?string $visualization = null)

Source from the content-addressed store, hash-verified

391 * @throws Exception
392 */
393 #[NoAdminRequired]
394 #[UseSession]
395 #[PublicPage]
396 public function readPublic($token, $filteroptions, $dataoptions, $chartoptions, $tableoptions, ?string $chart = null, ?string $visualization = null) {
397 $share = $this->ShareService->getReportByToken($token);
398 if (empty($share)) {
399 // Dataset not shared or wrong token
400 return new NotFoundResponse();
401 } else {
402 if ($share['password'] !== null) {
403 if (!$this->DataSession->isShareAuthenticated($token, $share['password'])) {
404 return new NotFoundResponse();
405 }
406 }
407 $share = $this->evaluateCanFilter($share, $filteroptions, $dataoptions, $chartoptions, $tableoptions, $chart, $visualization);
408 $result = $this->getData($share);
409 return new DataResponse($result, HTTP::STATUS_OK);
410 }
411 }
412
413 /**
414 * 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