コード例 #1
0
ファイル: UserSession.php プロジェクト: xsat/www.test.com
 public function get()
 {
     if ($this->session->has('user')) {
         $user_id = $this->decrypt($this->session->get('user'));
         return \Models\User::findFirst($user_id);
     }
     return null;
 }
コード例 #2
0
 /**
  * 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;
 }