2017 © Pedro Peláez
 

library acl-entity

Support for entities annotated for ACL.

image

naprstek/acl-entity

Support for entities annotated for ACL.

  • Friday, April 6, 2018
  • by naprstek
  • Repository
  • 1 Watchers
  • 0 Stars
  • 8 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

AclEntity

Support for entities annotated for ACL., (*1)

To install this library, run the command below and you will get the latest version:, (*2)

composer require naprstek/acl-entity

Usage

Create data entity this way:, (*3)

<?php

namespace AclEntity\Tests\Entity;

use AclEntity\IEntity;
use AclEntity\Entity\Entity;
use AclEntity\Annotation\Acl;

class Element extends Entity implements IEntity {
    /**
     * @var integer
     * @Acl({"view":{"internal", "external"}, "edit":{}})
     */
    private $id;

    /**
     * @var string
     * @Acl({"view":{"internal"}, "edit":{"external"}})
     */
    private $name;

    /**
     * @var string
     * @Acl({"view":{"external"}, "edit":{"internal"}})
     */
    private $value;
}

For property id: role "internal" and "external" has right "view" and no role has right "edit" (you can ommit this definition, but this way is more describing)., (*4)

Then in your ACL (based on Zend\Permissions\Acl\Acl for example) you define:, (*5)

//Roles
$this->addRole(new Role('internal'));
$this->addRole(new Role('external'));

//Resources: it is our data propertis
$my = new Element();
foreach($my->getAllProperties() as $resource) {
    $this->addResource(new Resource($resource));
}

//define privilleges
$this->allow('internal', $my->getAclProperties('internal', 'view'), 'view');
$this->allow('internal', $my->getAclProperties('internal', 'edit'), 'edit');
$this->allow('external', $my->getAclProperties('external', 'view'), 'view');
$this->allow('external', $my->getAclProperties('external', 'edit'), 'edit');

The Versions

06/04 2018

dev-master

9999999-dev

Support for entities annotated for ACL.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Vladimir Naprstek

acl entity zf3

06/04 2018

1.1.0

1.1.0.0

Support for entities annotated for ACL.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Vladimir Naprstek

acl entity zf3

29/03 2018

1.0.0

1.0.0.0

Support for entities annotated for ACL.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Vladimir Naprstek

acl entity zf3

29/03 2018

0.1.1

0.1.1.0

A set of User Defined Functions to Doctrine 2, basically for MSSQL.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Vladimir Naprstek

acl entity zf3

29/03 2018

0.1.0

0.1.0.0

A set of User Defined Functions to Doctrine 2, basically for MSSQL.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Vladimir Naprstek

acl entity zf3