Пример #1
0
 /**
  * (non-PHPdoc)
  * @see cake/libs/controller/Controller#beforeFilter()
  */
 public function beforeFilter()
 {
     parent::beforeFilter();
     if ($this->Components->attached('Auth')) {
         $this->Auth->allow('authorize_url', 'authenticate_url', 'callback');
     }
 }
Пример #2
0
 /**
  * (non-PHPdoc)
  * @see cake/libs/controller/Controller#beforeFilter()
  */
 public function beforeFilter()
 {
     parent::beforeFilter();
     if (!empty($this->Auth) && is_object($this->Auth)) {
         $this->Auth->allow('authorize_url', 'authenticate_url', 'callback');
     }
 }
Пример #3
0
 function beforeFilter()
 {
     $hasAdmin = $this->User->hasAdminUser();
     $this->set('has_admin', $hasAdmin);
     // RSS Authentication by user model
     if ($this->RequestHandler->isRss()) {
         $this->Auth->allow('index');
         $this->Security->loginOptions = array('type' => 'basic', 'login' => 'authenticate', 'realm' => 'My_RSS_Feeds');
         $this->Security->loginUsers = array();
         $this->Security->requireLogin('*');
     }
     // UsersControllerの認証除外設定
     if (get_class($this) == "UsersController") {
         if (!$hasAdmin) {
             $this->Auth->allow(array('add'));
         }
         $this->Auth->allow(array('reset_password', 'reset_password_mail'));
     }
     if (isset($this->Auth)) {
         //コントローラー側でさらに詳細を判別
         $this->Auth->authorize = 'controller';
         //ログインできるユーザの条件をデータベースのフィールドの値で指定
         $this->Auth->userScope = array("User.disabled" => 0);
         //ログイン処理を行うactionを指定(/users/loginがデフォルト)。
         $this->Auth->loginAction = "/users/login";
         //ログインが失敗した際のエラーメッセージ
         $this->Auth->loginError = __("Invalid username or password", true);
         //権限が無いactionを実行した際のエラーメッセージ
         $this->Auth->authError = __('You have no privileges', true);
         //ログイン後にリダイレクトするURL
         $this->Auth->loginRedirect = "/users/index";
         //ユーザIDとパスワードがあるmodelを指定(’User’がデフォルト)
         $this->Auth->userModel = "User";
         //ユーザIDとパスワードのフィールドを指定(username、password がデフォルト)
         $this->Auth->fields = array("username" => "loginname", "password" => "password");
         //自動リダイレクトしない
         $this->Auth->autoRedirect = false;
         // ログインユーザ情報をviewに受け渡し
         $login_user = $this->Auth->User();
         $this->set('login_user', $login_user['User']);
     }
     $project = $this->Project->getProjectInfo();
     $this->set('project_info', $project["Project"]);
     $sprint = $this->Sprint->getActiveSprintList();
     $this->set('sprint_info', $sprint);
 }
 private static function _authSetting(AuthComponent $auth)
 {
     $auth->allow('login', 'logout');
 }
Пример #5
0
 /**
  * 2.1 fix for allowing * as wildcard
  * 2012-01-10 ms
  */
 public function allow($action = null)
 {
     if ((array) $action === array('*')) {
         parent::allow();
         return;
     }
     $args = func_get_args();
     if (empty($args) || $action === null) {
         parent::allow();
     }
     parent::allow($args);
 }