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

Method readPublic

lib/Controller/OutputController.php:315–335  ·  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 $password = $this->DataSession->getPasswordForShare($token);
326 $passwordVerification = $this->ShareService->verifyPassword($password, $share['password']);
327 if ($passwordVerification === false) {
328 return new NotFoundResponse();
329 }
330 }
331 $share = $this->evaluateCanFilter($share, $filteroptions, $dataoptions, $chartoptions, $tableoptions);
332 $result = $this->getData($share);
333 return new DataResponse($result, HTTP::STATUS_OK);
334 }
335 }
336
337 /**
338 * evaluate if the user did filter in the report and if he is allowed to filter (shared reports)

Callers

nothing calls this directly

Calls 5

evaluateCanFilterMethod · 0.95
getDataMethod · 0.95
getPasswordForShareMethod · 0.80
verifyPasswordMethod · 0.80
getReportByTokenMethod · 0.45

Tested by

no test coverage detected