marcusamatos/jvs-acl

Zend\Acl module to Zend Framework 2

1.0.4 2014-06-02 23:40 UTC

README

This module provide a simple acl controller for zf2. This module can be used with Doctrin ORM. This is very simple, only implement the JvsAcl\Entity\UserGroupProviderInterface.

Requirements

Installation

  1. Add this project in your composer.json:
"required": {
    "marcusamatos/jvs-acl": "1.*"
}
  1. Enabling ir in your application.config.php file.
return array(
    'modules' => array(
        #[...]
        'JvsAcl'
        #[...]
    );
);
  1. Add \JvsAcl\Entity\GroupProviderInterface to your user entity

  2. Add in 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'
            ),
        )
    )
    #[...]
);