开发者

Zend Plugin works only in one module

开发者 https://www.devze.com 2023-01-15 14:06 出处:网络
I have created a plugin, that ckecks authorization status and gives access for using application. This plugin works fine, but in whole project. I want to make it works only in admin module. How can I

I have created a plugin, that ckecks authorization status and gives access for using application. This plugin works fine, but in whole project. I want to make it works only in admin module. How can I do this? I have defined plugin in application.ini:

resources.frontController.plugins.authche开发者_运维技巧ck = Application_Plugin_AuthCheck

Thanks for your help.


One way:

admin.resources.frontController.plugins.authcheck = Application_Plugin_AuthCheck

Second way: check in plugin module's name:

if ($this->getRequest()->getModuleName() == 'admin') {
    //process
}
0

精彩评论

暂无评论...
验证码 换一张
取 消