2017 © Pedro Peláez
 

library aclman

A library designed to manage ACL

image

ripaclub/aclman

A library designed to manage ACL

  • Thursday, February 16, 2017
  • by leodido
  • Repository
  • 4 Watchers
  • 3 Stars
  • 215 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 1 Forks
  • 2 Open issues
  • 7 Versions
  • 0 % Grown

The README.md

ACL manager

Latest Stable Version Build Status Coverage Status, (*1)

AclMan is a PHP library designed to manage access control list (ACL)., (*2)

Requisites

  • PHP >= 5.4, (*3)

  • Composer, (*4)

Features

AclMan has various features:, (*5)

  • Assertions, (*6)

    It provides an AssertionPluginManager whose goal is to deliver the assertions (i.e., AssertionInterface objects), (*7)

  • Permissions, (*8)

    Contains a class, GenericPermission, that is a container of permission options (e.g., a role, a resource, a privilege, an assertion), (*9)

  • Resources and roles, (*10)

    It provides a set of traits aimed to check the validity of resources and roles and instantiate their relative classes, (*11)

  • Storages, (*12)

    AclMan allows you to save the ACL configuration in several layers persistence, via StorageInterface objects and adapters (e.g., ArrayAdapter), (*13)

  • Services, (*14)

    A set of classes aimed at the instantiation of ACL objects, (*15)

Installation

Add ripaclub/aclman to your composer.json., (*16)

{
   "require": {
       "ripaclub/aclman": "~0.2.0"
   }
}

Configuration

AclMan library has only two configuration nodes:, (*17)

  1. aclman_storage to configure the persistence layer in which to save your ACL rules, (*18)

  2. aclman_services to configure your services (e.g., a storage and optionally a plugin manager), (*19)

Usage (1)

So, here is an example of use. You first need to configure the factories., (*20)

Put this PHP array into your configuration file., (*21)

'abstract_factories' => [
    'AclMan\Service\ServiceFactory',
    'AclMan\Storage\StorageFactory'
],
'factories' => [
    'AclMan\Assertion\AssertionManager' => 'AclMan\Assertion\AssertionManagerFactory'
]

Then we configure our service., (*22)

'aclman_services' => [
    'AclService\Ex1' => [
        'storage' => 'AclStorage\Ex1',
        'plugin_manager' => 'AclMan\Assertion\AssertionManager',
    ],
]
'aclman-assertion-manager' => [
    'invokables' => [
        'assertAlias' => 'assertionClass',
        ...
        ...
    ]
]

Finally, our storage configuration., (*23)

'aclman_storage' => [
    'AclStorage\Ex1' => [
        'roles' => [
             // Config specific permission for role Role1 to resources Resource1 and Resource2
            'Role1' => [
                'resources' => [
                    'Resource1' => [
                        [
                            'assert' => null,
                            'allow' => true,
                            'privilege' => 'add'
                        ]
                    ],
                    'Resource2' => [
                        [
                            'assert' => [
                                'assertAlias' => [
                                    'config' => 'test'
                                ],
                            ],
                            'allow' => true,
                            'privilege' => 'view'
                        ]
                    ]
                ],
            ],
            // Config specific permission for all roles to resource Resource1 (e.x public resource)
            StorageInterface::ALL_ROLES => [
                'resources' => [
                    'Resource3' => [
                        [
                            'allow' => true,
                        ]
                    ],
                ]
            ],
            // Config specific permission for Admin to all resource (e.x access to al resource to the admin)
            'Admin' => [
                'resources' => [
                    StorageInterface::ALL_RESOURCES  => [
                        [
                            'allow' => true,
                        ]
                    ],
                ]
            ],
        ],
    ],
]

Our first ACL configuration is now complete. Use it:, (*24)

$aclService1 = $serviceLocator->get('AclService\Ex1');
$aclService1->isAllowed('Role1', 'Resource1', 'view'); // FALSE
$aclService1->isAllowed('Role1', 'Resource1', 'add'); // TRUE
// ...

Notice the behaviour ..., (*25)

$aclService1 = $serviceLocator->get('AclService\Ex1');
$aclService1->isAllowed('Role1', 'Resource1', 'add'); // TRUE
$aclService1->isAllowed('Role1', 'Resource2', 'view'); // FALSE
// ...

Analytics, (*26)

The Versions

16/02 2017

dev-zf-3

dev-zf-3 http://github.com/ripaclub/aclman

A library designed to manage ACL

  Sources   Download

BSD-2-Clause

The Requires

 

The Development Requires

acl roles storage resources access control list acl manager privileges

28/01 2017

dev-develop

dev-develop http://github.com/ripaclub/aclman

A library designed to manage ACL

  Sources   Download

BSD-2-Clause

The Requires

 

The Development Requires

acl roles storage resources access control list acl manager privileges

28/01 2017

dev-master

9999999-dev http://github.com/ripaclub/aclman

A library designed to manage ACL

  Sources   Download

BSD-2-Clause

The Requires

 

The Development Requires

acl roles storage resources access control list acl manager privileges

28/01 2017

v0.3.0

0.3.0.0 http://github.com/ripaclub/aclman

A library designed to manage ACL

  Sources   Download

BSD-2-Clause

The Requires

 

The Development Requires

acl roles storage resources access control list acl manager privileges

01/10 2015

v0.2.1

0.2.1.0 http://github.com/ripaclub/aclman

A library designed to manage ACL

  Sources   Download

BSD-2-Clause

The Requires

 

The Development Requires

acl roles storage resources access control list acl manager privileges

29/04 2015

v0.2.0

0.2.0.0 http://github.com/ripaclub/aclman

A library designed to manage ACL

  Sources   Download

BSD-2-Clause

The Requires

 

The Development Requires

acl roles storage resources access control list acl manager privileges

28/10 2014

v0.1.0

0.1.0.0 http://github.com/ripaclub/aclman

A library designed to manage ACL

  Sources   Download

BSD-2-Clause

The Requires

 

The Development Requires

acl roles storage resources access control list acl manager privileges