marcusamatos/jvs-acl

Zend\Acl 模块用于 Zend Framework 2

1.0.4 2014-06-02 23:40 UTC

This package is not auto-updated.

Last update: 2024-09-28 16:31:03 UTC


README

此模块为 zf2 提供了一个简单的 acl 控制器。此模块可以与 Doctrin ORM 一起使用。它非常简单,只需要实现 JvsAcl\Entity\UserGroupProviderInterface

要求

安装

  1. 将此项目添加到您的 composer.json 文件中。
"required": {
    "marcusamatos/jvs-acl": "1.*"
}
  1. 在您的 application.config.php 文件中启用它。
return array(
    'modules' => array(
        #[...]
        'JvsAcl'
        #[...]
    );
);
  1. \JvsAcl\Entity\GroupProviderInterface 添加到您的用户实体中

  2. module.config.php 中添加

return array(
    #[...]
    'jvs-acl' => array(
        'groups' => array(
            'guest',
            'member' => array('name' => 'Member', 'parent' => 'guest', 'visible' => true),
            'admin' => array('name' => 'Administrator', 'parent' => 'member', 'visible' => true),
            'developer' => array('name' => 'Developer', 'parent' => 'admin')
        ),
        'controllers' => array(
            'Application\Controller\Index' => array(
                'guest' => 'allow'
            ),
            'Application\Controller\Auth' => array(
                'guest' => array(
                    'allow' => array('index', 'forgetPassword')
                )
            ),
            'Admin\Controller\Index' => array(
                'admin'
            ),
        )
    )
    #[...]
);