2017 © Pedro Peláez
 

library authrole

Integrate Aura\Auth and Zend\Permissions\Acl

image

fusible/authrole

Integrate Aura\Auth and Zend\Permissions\Acl

  • Saturday, May 21, 2016
  • by jnj
  • Repository
  • 1 Watchers
  • 0 Stars
  • 9 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

fusible.authrole

Integrate Aura\Auth and Zend\Permissions\Acl, (*1)

![Latest version][ico-version] Build Status ![Coverage Status][ico-scrutinizer] Quality Score, (*2)

Installation

composer require fusible/authrole

Usage

Replace Aura\Auth\AuthFactory with Fusible\AuthRole\AuthFactory. The resulting Auth object will implement Zend\Permissions\Acl\Role\RoleInterface, (*3)

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

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., (*5)

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

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

$acl->addRole(Auth::GUEST)
    ->addRole(Auth::MEMBER);

$acl->addResource('someResource');

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


$resume = $factory->newResumeService();
$resume->resume($auth);

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

The Versions

21/05 2016

dev-develop

dev-develop https://github.com/fusible/fusible.authrole

Integrate Aura\Auth and Zend\Permissions\Acl

  Sources   Download

MIT

The Requires

 

by jake johns