public function shouldLockIfNoPermission($permission, $redirectedPage = '/', $message = 'You do not have permission to do this!') { if (!$this->session->has('user')) { $this->flash->warning('You must be logged in!'); $this->redirect('/members/login?breadcrumb=' . h($_SERVER['REQUEST_URI'])); return true; } $roleService = new Role($this->db); if (!$roleService->isAllowed($this->session->get('user.username'), $permission)) { $this->flash->warning($message); $this->redirect($redirectedPage); return true; } return false; }