Created
March 9, 2010 02:47
-
-
Save jakemcgraw/326089 to your computer and use it in GitHub Desktop.
One way to do authorization in Zend Framework
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// .. bootstrap | |
Zend_Registry::set('identity', new Zend_Session_Namespace()); | |
// .. login | |
$result = $this->_auth->authenticate($adapter); | |
if ($result->isValid()) { | |
$ident = $this->_auth->getIdentity(); | |
$model = new Model_User; | |
$data = $model->getSessionData($ident); | |
$identity = Zend_Registry::get('identity'); | |
foreach($data as $fld => $val) { | |
$identity->{$fld} = $val; | |
} | |
} | |
// .. logout | |
Zend_Auth::getInstance()->clearIdentity(); | |
Zend_Registry::get('identity')->unsetAll(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment