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

Method readPublic

lib/Controller/OutputController.php:315–333  ·  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

313 * @throws Exception
314 */
315 #[NoAdminRequired]
316 #[UseSession]
317 #[PublicPage]
318 public function readPublic($token, $filteroptions, $dataoptions, $chartoptions, $tableoptions) {
319 $share = $this->ShareService->getReportByToken($token);
320 if (empty($share)) {
321 // Dataset not shared or wrong token
322 return new NotFoundResponse();
323 } else {
324 if ($share['password'] !== null) {
325 if (!$this->DataSession->isShareAuthenticated($token, $share['password'])) {
326 return new NotFoundResponse();
327 }
328 }
329 $share = $this->evaluateCanFilter($share, $filteroptions, $dataoptions, $chartoptions, $tableoptions);
330 $result = $this->getData($share);
331 return new DataResponse($result, HTTP::STATUS_OK);
332 }
333 }
334
335 /**
336 * 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