Hodaka Matsuki
Hodaka Matsuki

Reputation: 15

Zend framework ACL fails for the first time to switch the server

Hi guys! I'm not native to English, so I'll appreciate if you correct my sentence!

To explain my issue, here is our development environment.

if I lack some info, please let me know

When we joint these project, the problems happen.

After logged in our service, the zend works oddly. the loginAction is on the a-ec2, we can successfully login with that. And we save that session information on redis, and it works normally. But only for the first time that we switch the server from a-ec2 to b-ec2, zend acl error has occur. We use isAllowed function for checking the privilege for whether the user has enough privilege to access certain service. The isAllowd function which located at line 827, /library/ZendAcl.php return false for the first time. Then, we reload the page, the isAllowed function return true so that we can access to the service. In detail, something went wrong around &_getRules function which is at line 1161, which is used _getRuleType function. In those process, somehow one of the array contain "TYPE_DENY". But when try to reload(ctrl + f5), that value turn into "TYPE_ALLOW".

How can this happen? And how to fix this?

We are trying to figure this out like 2 weeks or more... Thanks in advance!!

[update] we found that this method which is written in under doesn't work well, so that we can't get $auth properly.

The $auth return "".

        self::$_auth = $auth = Zend_Auth::getInstance()->getStorage()->read();

[update 2]

we might solve this issue, so I'll leave our solution.

we use

Zend_Auth::getInstance()->getStorage()->read()

to get $auth from session.

But for the first time, the session information which has saved at a-ec2 can't read at b-ec2. So, we decided to use session information at redis, so we changed method to get $auth like

        require_once 'Zend/Session.php';
        Zend_Session::start();
        self::$_auth = $auth = Common_Model_Redis::get();

start the session before connect to the redis server and just get session information form it! I hope this will work you too!

Upvotes: 0

Views: 203

Answers (0)

Related Questions