当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Auth::getStorage方法代码示例

本文整理汇总了PHP中Zend_Auth::getStorage方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Auth::getStorage方法的具体用法?PHP Zend_Auth::getStorage怎么用?PHP Zend_Auth::getStorage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Auth的用法示例。


在下文中一共展示了Zend_Auth::getStorage方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * Construtor do Plugin
  *
  * @param $acl Zend_Acl        	
  * @param $auth Zend_Auth        	
  */
 public function __construct($dbAdapter)
 {
     // Carrega todas as ACl's
     $this->acl = new Acl_Global($dbAdapter);
     // Recupera a informacao de autenticacao
     $this->auth = Zend_Auth::getInstance();
     // Adiciona o role padrao de visitante
     if (!$this->auth->hasIdentity()) {
         $authStorage = $this->auth->getStorage();
         $authStorage->write(array('usuario' => 'visitante', 'role' => 'visitante'));
     }
 }
开发者ID:vilmarsitio,项目名称:registrodeprecos,代码行数:18,代码来源:Autenticacao.php

示例2: preDispatch

 /**
  * Check permissions before dispatch process
  *
  * @throws Zend_Auth_Adapter_Exception if answering the authentication query is impossible
  * @param Zend_Controller_Request_Abstract $request
  * @return void
  */
 public function preDispatch(Zend_Controller_Request_Abstract $request)
 {
     $resource = $request->getControllerName();
     $action = $request->getActionName();
     if ($this->_auth->hasIdentity()) {
         $identity = $this->_auth->getStorage()->read();
         $role = $identity->role;
     } else {
         $role = $this->_defaultRole;
     }
     if ($this->_acl->has($resource) && !$this->_acl->isAllowed($role, $resource, $action)) {
         $request->setControllerName('error')->setActionName('deny');
     }
 }
开发者ID:nuxwin,项目名称:i-PMS,代码行数:21,代码来源:PermissionsCheck.php

示例3: getStorage

 /**
  * Возвращает объект-хранилище данных по авторизации
  *
  * @return Zend_Auth_Storage_Interface
  */
 public function getStorage()
 {
     if (true == Zend_Registry::get('config')->Access->cookie && Zend_Controller_Front::getInstance()->getRequest()->getParam('use_cookie')) {
         $this->setStorage(new Modules_Access_Framework_Auth_Storage_Cookie());
     }
     return parent::getStorage();
 }
开发者ID:kytvi2p,项目名称:ZettaFramework,代码行数:12,代码来源:Auth.php

示例4: referencesAction

 /**
  * Reference list action
  *
  */
 public function referencesAction()
 {
     $this->_setMetaTitle('My HomeLet | References');
     $this->_setBreadcrumbs(array('/' => 'Home', '/my-homelet' => 'My HomeLet', '/my-homelet/references' => 'My References'));
     // Get the customer session
     $customerSession = $this->auth->getStorage()->read();
     $request = $this->getRequest();
     // Search and ordering
     $filteredOrderBy = array();
     $orderBy = $request->getParam('order');
     $refnoSearch = $request->getParam('id');
     // Validate order by to restricted fields to those displayed on the front end
     if (is_array($orderBy)) {
         foreach ($orderBy as $orderByField => $orderByDirection) {
             if (in_array($orderByField, array('start_date', 'lastname', 'address1', 'externalrefno', 'status'))) {
                 // Copy field into new array
                 $filteredOrderBy[$orderByField] = $orderByDirection;
             }
         }
     }
     // Get list of external reference numbers
     $referencesAndReports = array();
     $referenceManager = new Manager_Referencing_Reference();
     $referenceIds = $referenceManager->getAllReferenceIds($customerSession->id);
     // Get all reference details
     $legacyRefManager = new Manager_ReferencingLegacy_Munt();
     $references = $legacyRefManager->getAllReferences($referenceIds, $refnoSearch, $filteredOrderBy);
     foreach ($references as $reference) {
         $report = $legacyRefManager->getLatestReport($reference->externalId);
         array_push($referencesAndReports, array('reference' => $reference, 'report' => $report));
     }
     $this->view->references = $referencesAndReports;
 }
开发者ID:AlexEvesDeveloper,项目名称:hl-stuff,代码行数:37,代码来源:PortalController.php

示例5: authenticate

 public function authenticate($username, $password)
 {
     $doctrineAuthAdapter = new Neo_Doctrine_Auth_Adapter(Doctrine_core::getConnectionByTableName('Usuario'));
     $doctrineAuthAdapter->setTableName('Usuario u')->setIdentityColumn('u.email')->setCredentialColumn('u.password')->setIdentity($username)->setCredential(md5($password));
     if ('backend' === $this->_module) {
         //$doctrineAuthAdapter->setCredentialTreatment("MD5(?) AND c.status = true AND c.admin = true");
     } else {
         //$doctrineAuthAdapter->setCredentialTreatment("MD5(?) AND c.status = true AND c.admin = false");
     }
     $authResult = $this->_auth->authenticate($doctrineAuthAdapter);
     switch ($authResult->getCode()) {
         case Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND:
             $this->_flashMessenger->addError($this->_message[self::NOT_IDENTITY]);
             break;
         case Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID:
             $this->_flashMessenger->addError($this->_message[self::INVALID_CREDENTIAL]);
             break;
         case Zend_Auth_Result::SUCCESS:
             if ($authResult->isValid()) {
                 $identity = $doctrineAuthAdapter->getResultRowObject('id', 'password', 'admin');
                 $this->_auth->getStorage()->write($identity);
             } else {
                 $this->_flashMessenger->addError($this->_message[self::INVALID_USER]);
             }
             break;
         default:
             $this->_flashMessenger->addError($this->_message[self::INVALID_LOGIN]);
             break;
     }
     return $this->_auth;
 }
开发者ID:Neozeratul,项目名称:Intermodels,代码行数:31,代码来源:Login.php

示例6: _fetchDocument

 /**
  * Retrieve the document
  *
  * @param string $policyNumber Policy number
  * @param string $documentId Unique document request hash
  * @return string null or PDF contents
  */
 private function _fetchDocument($policyNumber, $documentId)
 {
     // Get the customer session
     $customerSession = $this->auth->getStorage()->read();
     // Get the request policy
     if ($policyNumber[0] == 'Q') {
         // Quotes
         $legacyPolicies = new Datasource_Insurance_LegacyQuotes();
     } else {
         // Policies
         $legacyPolicies = new Datasource_Insurance_LegacyPolicies();
     }
     $policy = $legacyPolicies->getByPolicyNumber($policyNumber);
     if (!$policy) {
         return null;
     }
     // Check the policy customer refno is linked to the customer id through mapping
     $customerMaps = new Datasource_Core_CustomerMaps();
     $customerMap = $customerMaps->getMap(Model_Core_Customer::LEGACY_IDENTIFIER, $policy->refNo);
     // Confirm the policy number belongs to the logged in customer
     if ($customerMap == false || $customerMap->getIdentifier() != $customerSession->id) {
         // Customer map not found or customer is not mapped to refno, render error message
         return null;
     }
     // Get all document details
     $documentHistory = new Datasource_Insurance_DocumentHistory();
     $document = $documentHistory->getDocument($documentId, $policyNumber);
     if (!$document) {
         return null;
     }
     // Retrieve document from store
     $documentFulfillmentService = new Service_Insurance_Document();
     return $documentFulfillmentService->retrieveDocumentFromStore($documentId, $document->template_name, Service_Insurance_Document::DOCUMENT_AND_ATTACHMENTS);
 }
开发者ID:AlexEvesDeveloper,项目名称:hl-stuff,代码行数:41,代码来源:DocumentViewerController.php

示例7: getIdentityRole

 /**
  * Retrieves a role from the current identity
  *
  * @return null|string
  */
 public function getIdentityRole()
 {
     if (!$this->_auth->hasIdentity()) {
         return null;
     }
     $storage = $this->_auth->getStorage()->read();
     return $storage->role;
 }
开发者ID:BGCX262,项目名称:zym-svn-to-git,代码行数:13,代码来源:Acl.php

示例8: forceAuthenticate

 public function forceAuthenticate($userUuid)
 {
     // Get a reference to the singleton instance of Zend_Auth
     $this->_auth = Zend_Auth::getInstance();
     // Set the storage interface
     $this->_auth->setStorage(new Glo_Auth_Storage_Session('Glo_Auth'));
     $storage = $this->_auth->getStorage();
     $data = new stdClass();
     $data->user_uuid = $userUuid;
     $storage->write($data);
     return;
 }
开发者ID:highhair20,项目名称:glo,代码行数:12,代码来源:Auth.php

示例9: authenticate

 /**
  * @return Zend_Auth_Result
  */
 public function authenticate(Zend_Auth $auth, $username, $password, $persistIfSuccessful = true)
 {
     $adapter = new Zend_Auth_Adapter_DbTable(Zend_Db_Table_Abstract::getDefaultAdapter(), 'user', 'username', 'user_credential.value');
     $adapterSelect = $adapter->getDbSelect()->join('user_credential', 'user_credential.user_id = user.id')->where('user_credential.type = "PASSWORD"');
     $adapter->setIdentity($username)->setCredential(md5($password));
     // SQLite has no internal md5() function
     $authResult = $auth->authenticate($adapter);
     if (!$authResult->isValid() || $persistIfSuccessful == false) {
         return $authResult;
     }
     $userInfo = $adapter->getResultRowObject(array('id', 'username'));
     /** NEEDS TO BE IMPLEMENTED **/
     // Store all user details except password in authentication session
     $auth->getStorage()->write($currentUser);
     return $authResult;
 }
开发者ID:resscode,项目名称:frbr,代码行数:19,代码来源:AuthenticationService.php

示例10: identifyAction

 /** Identify the user
  * @access public
  * @return void
  */
 public function identifyAction()
 {
     if ($this->getRequest()->isPost()) {
         $formData = $this->_getFormData();
         if (empty($formData['username']) || empty($formData['password'])) {
             $this->getFlash()->addMessage('Please provide a username and password.');
         } else {
             // do the authentication
             $authAdapter = $this->_getAuthAdapter($formData);
             $result = $this->_auth->authenticate($authAdapter);
             if (!$result->isValid()) {
                 $this->getFlash()->addMessage('Login failed');
             } else {
                 $data = $authAdapter->getResultRowObject(null, 'password');
                 $this->_auth->getStorage()->write($data);
                 $this->redirect(self::REDIRECT);
             }
         }
     }
 }
开发者ID:lesleyauk,项目名称:findsorguk,代码行数:24,代码来源:IndexController.php

示例11: successAction

 /** On success action
  * @access public
  * @return void
  */
 public function successAction()
 {
     if (null === $this->_auth->getIdentity()) {
         $this->view->headTitle('Login to the system');
         $form = new LoginForm();
         $this->view->form = $form;
         if ($this->_request->isPost()) {
             $formData = $this->_request->getPost();
             if ($form->isValid($formData)) {
                 $authAdapter = $form->username->getValidator('Authorise')->getAuthAdapter();
                 $data = $authAdapter->getResultRowObject(null, 'password');
                 $this->_auth->getStorage()->write($data);
                 $this->redirect($this->_helper->loginRedirect());
             } else {
                 $this->_auth->clearIdentity();
                 $this->getFlash()->addMessage('Sorry, there was a problem with your submission.
             Please check and try again');
                 $form->populate($formData);
             }
         }
     } else {
         $this->redirect('/users/');
     }
 }
开发者ID:lesleyauk,项目名称:findsorguk,代码行数:28,代码来源:AccountController.php

示例12: storageUser

 /**
  * @return boolean
  */
 public function storageUser(stdClass $user)
 {
     $this->_zendAuth->getStorage()->write($user);
     $authNamespace = new Zend_Session_Namespace('auth');
     $authNamespace->timeout = time() + __MAXIMO_MINUTOS_SESSAO__ * 60;
 }
开发者ID:roquebrasilia,项目名称:sgdoc-codigo,代码行数:9,代码来源:Authentication.php

示例13: init

 public function init()
 {
     $customer = $this->auth->getStorage()->read();
     // Set custom subform decorator
     $this->setDecorators(array(array('ViewScript', array('viewScript' => 'subforms/logged-in.phtml', 'customer' => $customer))));
 }
开发者ID:AlexEvesDeveloper,项目名称:hl-stuff,代码行数:6,代码来源:LoggedIn.php

示例14: getNamespace

 /**
  * Get namespace of a session
  *
  * @return string session namespace
  */
 public function getNamespace()
 {
     return $this->_zendAuth->getStorage()->getNamespace();
 }
开发者ID:Ewaldaz,项目名称:Be-your-light,代码行数:9,代码来源:Authentication.php


注:本文中的Zend_Auth::getStorage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。