1

I'm now sitting here a little bit longer and i want to know the best solution to update the Identity from the Zend_Auth.

public function _initLoadSessionData() {
    if (Zend_Auth::getInstance()->hasIdentity()) {
        $userTbl = new Application_Model_User();
        $userData = $userTbl->getUserData(Zend_Auth::getInstance()->getIdentity()->ID);

        $zendAuth = Zend_Auth::getInstance()->getIdentity();

        foreach ($userData as $key => $value) {
            $zendAuth->$key = $value;
        } 
    }
}

This is the first try i did and it works very well. I put this function into the Bootstrap but I'm sure that this solution is very bad (e.g. performance) because it updates every time. The problem is, that i want to update the Zend_Acl Roles and it needs to be updated instantly. Thanks for your help guys! :)

Claicon
  • 11
  • 2

1 Answers1

0

You shoud use a plugin.

Create a class that extends Zend_Controller_Plugin_Abstract and implemente the preDispatch method. Inside it you can check on updates over ACL and redirect the request to another controller/action if something is not allowed.

Don't forget to register the plugin on Bootstrap.php

Zend_Controller_Front::getInstance()->registerPlugin(new My_Plugin());
fkupper
  • 520
  • 3
  • 9