本文整理汇总了PHP中AuthComponent::startup方法的典型用法代码示例。如果您正苦于以下问题:PHP AuthComponent::startup方法的具体用法?PHP AuthComponent::startup怎么用?PHP AuthComponent::startup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AuthComponent
的用法示例。
在下文中一共展示了AuthComponent::startup方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: startup
/**
* Main execution method. Initializes CAS client and force authentication if required before passing user to parent startup method.
*
* @param object $controller A reference to the instantiating controller object
* @return boolean
* @access public
*/
function startup(&$controller)
{
// CAS authentication required if user is not logged in
//debug($controller);exit;
//if (!$this->user()) {
if (!isset($this->request->query['ticket'])) {
// Set debug mode
phpCAS::setDebug(false);
//if(!empty(phpCAS::getUser()))
// debug($this);
//Initialize phpCAS
//debug(isset($this->request->query['ticket']));
phpCAS::client(CAS_VERSION_2_0, Configure::read('CAS.hostname'), Configure::read('CAS.port'), Configure::read('CAS.uri'));
// No SSL validation for the CAS server
phpCAS::setNoCasServerValidation();
// Force CAS authentication if required
phpCAS::forceAuthentication();
//debug();exit;
$model =& $this->getModel();
$controller->data[$model->alias][$this->fields['username']] = phpCAS::getUser();
$controller->data[$model->alias][$this->fields['password']] = 'a';
//$this->User->['username']=phpCAS::getUser();
//$this->User->['password']='a';
}
return parent::startup($controller);
//$this->redirect(array('controller'=>'User','action'=>'login'));
}
示例2: startup
/**
* Sets the user ID on RequestLoggable component, if it is being used
*
* @access public
* @param object $Controller
* @return void
*/
function startup($Controller)
{
parent::startup($Controller);
if (isset($this->Controller->RequestLoggable)) {
$this->Controller->RequestLoggable->set('user_id', $this->user('id'));
}
}
示例3: startup
public function startup($Controller)
{
$result = $this->Authenticators->triggerCallback('before', 'startup', array($Controller));
if (!$this->Authenticators->interrupted) {
// workaround warning error with 'expected argument 1 as a reference'
$result = parent::startup($Controller);
}
$result = $this->Authenticators->triggerCallback('after', 'startup', array($result), 'enchain');
return $result;
}
示例4: startup
/**
* Over-ride of startup function. Adds 'User' with id of 0 if not logged in for use in ACL
*
* @return null
* @access public
*/
public function startup(&$controller)
{
$user = ClassRegistry::init(Configure::read('Permissible.UserModel'));
$this->actionPath = 'app/';
$this->authorize = 'actions';
if ($this->user($user->primaryKey) === null) {
$this->_unlogged = true;
$this->Session->write($this->sessionKey, array($user->primaryKey => 0));
}
parent::startup($controller);
if ($this->_unlogged) {
$this->Session->delete($this->sessionKey);
}
}
示例5: startup
/**
* Démarrage du composant.
* Autorisation si pas de préfixe dans la Route qui a conduit ici.
*
* @param object $controller Le contrôleur qui a appelé le composant.
*/
function startup($controller)
{
$prefix = null;
if (empty($controller->params['prefix'])) {
$this->allow();
} else {
$prefix = $controller->params['prefix'];
}
// Cas spécial des actions de login et logout, pour lesquelles le préfixe n'existe pas
if (in_array($controller->action, array('login', 'logout'))) {
switch ($controller->name) {
case 'Users':
$prefix = 'admin';
break;
case 'Members':
$prefix = 'members';
break;
}
}
$this->_setup($prefix);
parent::startup($controller);
}