/** * Show full logs modal for a report (manually or cron job) */ public function fullLogModalAction() { $report = Report::findById($this->request->get('id')); $this->view->report = $report; }
public function getReport() { return Report::findById($this->rid); }
/** * Change and assign permision for a report of for an user * Will always return integer "1" */ public function changePermissionAction() { //case of permission per report if ($this->request->get('report')) { $report = Report::findById($this->request->get('report')); $users = User::find(['conditions' => ['type' => 'operator', 'status' => 1]]); $perm = $this->request->get('perm'); foreach ($users as $user) { if (isset($perm[$user->getId()]) && in_array('view', $perm[$user->getId()])) { $user->setPermission('Report', $report->getId(), $perm[$user->getId()]); } else { $user->unsetPermission('Report', $report->getId(), $perm[$user->getId()]); } $user->save(); } } //case of permission per user if ($this->request->get('user')) { $user = User::findById($this->request->get('user')); $user->removePermissions(); if ($perm = $this->request->get('perm')) { foreach ($perm as $key => $val) { $user->setPermission('Report', $key, $val); } } $user->save(); } echo 1; $this->view->setRenderLevel(View::LEVEL_NO_RENDER); }