本文整理汇总了PHP中AuthComponent::allow方法的典型用法代码示例。如果您正苦于以下问题:PHP AuthComponent::allow方法的具体用法?PHP AuthComponent::allow怎么用?PHP AuthComponent::allow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AuthComponent
的用法示例。
在下文中一共展示了AuthComponent::allow方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: beforeFilter
/**
* (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: beforeFilter
/**
* (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: beforeFilter
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);
}
示例4: _authSetting
private static function _authSetting(AuthComponent $auth)
{
$auth->allow('login', 'logout');
}
示例5: allow
/**
* 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);
}