Integrate Aura\Auth and Zend\Permissions\Acl

dev-develop 2016-05-21 04:42 UTC

This package is auto-updated.

Last update: 2020-05-29 20:45:09 UTC


Integrate Aura\Auth and Zend\Permissions\Acl

Latest version Build Status Coverage Status Quality Score


composer require fusible/authrole


Replace Aura\Auth\AuthFactory with Fusible\AuthRole\AuthFactory. The resulting Auth object will implement Zend\Permissions\Acl\Role\RoleInterface

If $auth->isValid() is false, $auth->getRoleId() will return Auth::GUEST ("guest").

If $auth->isValid() is true, getRoleId will look for a key role in the result of $auth->getUserData and return that, or return Auth::MEMBER ("member") if it is not set.

use Fusible\AuthRole\AuthFactory;
use Fusible\AuthRole\Auth;
use Zend\Permissions\Acl\Acl;

$factory = new AuthFactory($_COOKIE);
$auth = $factory->newInstance();
$acl = new Acl();



$acl->deny('guest', 'someResource');
$acl->allow('member', 'someResource');

$resume = $factory->newResumeService();

echo $acl->isAllowed($auth, 'someResource') ? 'allowed' : 'denied';