dongmi0760 2012-08-08 12:35
浏览 36
已采纳

Zend模块特定的ACL

In my projects there are about 5, 6 modules

Ex: Web - Public access, URL - www.abc.com
Admin - admin can access - admin.abc.com (Non Acl)
CP - Specific group can access - cp.abc.com (Non Acl)
pbo - Another group can access - pbo.abc.com (Acl based and implemented recently)

As given above, we recently added a module called PBO, based on ACL plugin,

each module has a specific Bootstrap file,

But after the implementation of new module, all the other modules are going through the ACL plugin and redirect to the default page of the PBO module.

This is how Privileges are set

$this->acl->allow('superAdmin', 'user', array('login','logout'));
$this->acl->allow('superAdmin', 'index', 'index');
$this->acl->allow('superAdmin', 'app', 'index');

$this->acl->allow('admin', 'user', array('index','login','logout','registered'));      
$this->acl->allow('admin', 'index', 'index');
$this->acl->allow('admin', 'app', array('index', 'do-feature', 'do-delete'));

Initialize ACL in the bootstrap file

public function _initAcl()
{
    //Omit the process in CLI mode
    if (php_sapi_name() != 'cli') 
    {        
        $helper = new Nexva_Controller_Action_Helper_AclPbo();
        $helper->setRoles();
        $helper->setResources();
        $helper->setPrivilages();
        $helper->setAcl();

        //Register the ACL plugin - Then it will be called automatically,whenever an     acion is called
        $frontController = Zend_Controller_Front::getInstance(); 
        $frontController->registerPlugin(new Nexva_Plugin_AclPbo());

    }
}

Is there any way to avoid calling ACL of PBO module in other modules ?

  • 写回答

2条回答 默认 最新

  • dqudtskm49788 2012-08-08 14:31
    关注

    This is an issue with Zend Framework 1.

    Bootstraps for all Modules are always called and executed for any given Module. This is how Zend Framework is designed.

    Due to this issue, there is one really good article to read to help understand how Module Bootstrapping works in ZF and it's shortcomings. It's written by Matthew Weier O'Phinney:

    http://mwop.net/blog/234-Module-Bootstraps-in-Zend-Framework-Dos-and-Donts.html

    From there, this site has a tutorial that talks about a solution to how to setup a "new" Bootstrap like layer that's module specific. It also links to several sources they pulled from, most of which are worth reading (yes, there's a fair bit of reading).

    http://offshootinc.com/blog/2011/02/11/modul-bootstrapping-in-zend-framework/

    I hope that helps!

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改