vim/acl

There is no license information available for the latest version (1.0.0) of this package.

Acl module for zend framework 3

1.0.0 2018-01-22 20:43 UTC

README

Module for Zend Framework 3.

Installation

Installation of this module uses composer. For composer documentation, please refer to getcomposer.org.

composer require vim/acl

Register Vim\Acl in config/modules.config.php:

<?php
return [
    'Vim\Acl',
];

Acl configuration

<?php
return [
    'acl' => [
        /**
         * ClassName instance of \Vim\Acl\Constant\RoleConstantAwareInterface
         */
        'roles' => null,
        'resources' => [
            /**
             * [resource, [privileges], [roles]]
             * To set all privileges, you can set "null" without [privileges]
             */
            'allow' => [],

            /**
             * [resource, [privileges], [roles]]
             * To set all privileges, you can set "null" without [privileges]
             */
            'deny' => [],
        ],
    ],
];

Example

<?php
return [
    'acl' => [
        'roles' => \Vim\Acl\Constant\RoleConstant::class,
        'resources' => [
            'allow' => [
                [Controller\User\UserController::class, null, ['admin']],
                [Controller\User\UserController::class, ['changePassword'], ['user']],
            ],
            'deny' => [
                [Controller\User\UserController::class, ['delete'], ['admin']],
            ],
        ],
    ],
];