Example #1
0
 /**
  * The before() method is called before controller action
  */
 public function before()
 {
     parent::before();
     // Load the oauth2 config
     $this->config = Config::load('oauth2')->as_array();
     // create array of supported response types
     $this->responseTypes = array('code' => new Oauth2_ResponseType_AuthorizationCode($this->config), 'token' => new Oauth2_ResponseType_AccessToken($this->config));
     /**
      * Indicates if the user should be re-prompted for consent.
      * The default is auto, so a given user should only see the consent page for a given set of scopes 
      * the first time through the sequence. If the value is force, then the user sees a 
      * consent page even if they previously gave consent to your application for a given set of scopes.
      */
     $this->approval_prompt = $this->request->query('approval_prompt');
     // @todo not implemented so far these 4 vars
     $this->access_type = $this->request->query('access_type');
     /** email address or sub identifier
      * Passing this hint will either pre-fill the email box on the sign-in form or 
      * select the proper multi-login session, thereby simplifying the login flow.
      */
     $this->login_hint = $this->request->query('login_hint');
     //Optional. A market string that determines how the consent UI is localized.
     $this->locale = $this->request->query('locale');
     /** The display type to be used for the authorization page. 
      *	Valid values are "popup", "touch", "page", or "none".
      */
     $this->display = $this->request->query('display');
     // Disable sidebars on oauth2
     $this->_sidebars = FALSE;
 }
Example #2
0
 /**
  * The before() method is called before controller action
  */
 public function before()
 {
     parent::before();
     $this->auto_render = FALSE;
     // Load the oauth2 config
     $this->config = Config::load('oauth2')->as_array();
 }
Example #3
0
 /**
  * The before() method is called before controller action
  *
  * @uses  ACL::required
  */
 public function before()
 {
     ACL::required('access comment');
     // Disable sidebars on comments page
     $this->_sidebars = FALSE;
     parent::before();
 }
Example #4
0
 /**
  * The before() method is called before controller action.
  */
 public function before()
 {
     // The action_index() is default
     if ($this->request->action() == 'index') {
         $this->request->action('welcome');
     }
     parent::before();
 }
Example #5
0
 public function before()
 {
     // Internal request only!
     if ($this->request->is_initial()) {
         throw HTTP_Exception::factory(404, 'Access denied!', array(':type' => '<small>' . $this->request->uri() . '</small>'));
     }
     ACL::required('access content');
     parent::before();
 }
Example #6
0
 /**
  * The before() method is called before controller action
  *
  * @uses  ACL::required
  * @uses  Theme::$is_admin
  */
 public function before()
 {
     // Inform tht we're in admin section for themers/developers
     Theme::$is_admin = TRUE;
     if ($this->request->action() != 'login') {
         ACL::redirect('administer site', 'admin/login');
     }
     parent::before();
 }
Example #7
0
 /**
  * The before() method is called before controller action
  *
  * @uses  Request::param
  * @uses  Request::action
  * @uses  ACL::required
  */
 public function before()
 {
     $id = $this->request->param('id', FALSE);
     if ($id and $this->request->action() == 'index') {
         $this->request->action('view');
     }
     if (!$id and $this->request->action() == 'index') {
         $this->request->action('list');
     }
     ACL::required('access content');
     parent::before();
 }
Example #8
0
 public function before()
 {
     parent::before();
     if ($this->_auth->logged_in() == false) {
         // No user is currently logged in
         $this->request->redirect('user/login');
     }
     if (Config::load('auth.enable_buddy', FALSE) == FALSE) {
         // If user buddy disabled, we return not ofund.
         throw HTTP_Exception::factory(404, __('Buddy not allowed'));
     }
     $this->user = $this->_auth->get_user();
 }
Example #9
0
 /**
  * The before() method is called before controller action
  *
  * @uses  Assets::css
  * @uses  Auth::get_user
  * @uses  Request::uri
  * @uses  Request::action
  */
 public function before()
 {
     Assets::css('user', 'media/css/user.css', array('theme'), array('weight' => 60));
     parent::before();
     // Get the currently logged in user or set up a new one.
     // Note that get_user will also do an auto_login check.
     if (($this->_user = $this->_auth->get_user()) === FALSE) {
         $this->_user = ORM::factory('user');
     }
     if (strpos($this->request->uri(), 'user/reset/', 0) !== FALSE) {
         $this->request->action('reset_' . $this->request->action());
     }
     // Disable sidebars on user pages
     $this->_sidebars = FALSE;
 }
Example #10
0
 /**
  * The before() method is called before controller action
  *
  * @throws  HTTP_Exception
  *
  * @uses    Assets::css
  * @uses    User::is_guest
  */
 public function before()
 {
     if (User::is_guest()) {
         throw HTTP_Exception::factory(403, 'Permission denied! You must login!');
     }
     $id = $this->request->param('id', FALSE);
     if ($id and 'index' == $this->request->action()) {
         $this->request->action('view');
     }
     if (!$id and 'index' == $this->request->action()) {
         $this->request->action('inbox');
     }
     Assets::css('user', 'media/css/user.css', array('theme'), array('weight' => 60));
     parent::before();
 }
Example #11
0
 /**
  * The before() method is called before controller action.
  *
  * @throws Http_Exception_404 If the provider is disabled
  *
  * @uses  Auth::logged_in
  * @uses  Route::get
  * @uses  Route::uri
  * @uses  Config::load
  * @uses  Session::get
  */
 public function before()
 {
     parent::before();
     // Disable sidebars on user pages
     $this->_sidebars = FALSE;
     // Load the session
     $this->session = Session::instance();
     // Set the provider controller
     $this->provider = strtolower($this->request->param('provider'));
     $providers = Auth::providers();
     // Throw exception if the provider is disabled
     if (!array_key_exists($this->provider, array_filter($providers))) {
         throw new Http_Exception_404('Unsupported provider', NULL);
     }
     $this->route = $this->request->route();
     // Load the client config
     $this->provider_config = Config::load("oauth2.providers.{$this->provider}");
     $this->client = OAuth2_Client::factory($this->provider, $this->provider_config['id'], $this->provider_config['secret']);
     if ($token = $this->session->get($this->key('access'))) {
         // Make the access token available
         $this->token = $token;
     }
 }
Example #12
0
 /**
  * The before() method is called before controller action
  *
  * @uses    ACL::required
  */
 public function before()
 {
     ACL::required('access content');
     parent::before();
 }
Example #13
0
 /**
  * The before() method is called before controller action
  *
  * @uses  ACL::required
  */
 public function before()
 {
     ACL::required('sending mail');
     parent::before();
 }