Beispiel #1
0
 /**
  * Checks if a session is active.
  *
  * @param   string   role name
  * @param   array    collection of role names
  * @return  boolean
  */
 public function logged_in($role = NULL)
 {
     $user = $this->session->get($this->config['session_key']);
     if (!(is_object($user) and $user instanceof Model_User and $user->loaded())) {
         if ($fb_uid = FB::get_loggedin_user()) {
             $user = ORM::factory('user')->where('fb_uid', '=', $fb_uid)->find();
             $this->force_login($user);
         }
     }
     return parent::logged_in($role);
 }
Beispiel #2
0
 /**
  * Ensure the user is logged in, else throw a 403 Exception.
  *
  * @throws HTTP_Exception
  */
 protected function logged_in_required()
 {
     if ($this->auth->logged_in() == FALSE) {
         throw HTTP_Exception::Factory(401, 'Login to access this page!');
     }
 }