public function get() { if ($this->session->has('user')) { $user_id = $this->decrypt($this->session->get('user')); return \Models\User::findFirst($user_id); } return null; }
/** * Basic function to check if user is allowed to execute POST, PUT & DELETE routes. * @return boolean */ public function isAllowed() { if (!$this->session->has('auth')) { return false; } $user = User::findFirst(array('username' => $this->session->get('auth'))); return $user->getSuperUser() ? true : false; }