Download the PHP package craftcamp/abac-bundle without Composer
On this page you can find all versions of the php package craftcamp/abac-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download craftcamp/abac-bundle
More information about craftcamp/abac-bundle
Files in craftcamp/abac-bundle
Package abac-bundle
Short Description Symfony Bundle to wrap php-abac library into symfony applications
License MIT
Informations about the package abac-bundle
CraftCamp ABAC Bundle
Introduction
This Symfony bundle implements support in the Symfony framework for the PHP ABAC library.
This is meant to implement in Symfony applications a new way to handle access control.
This method is based on a policy rules engine, analyzing user and resources attributes instead of roles alone.
Roles can be used, considering them as user attributes.
The advantages of this method is to easily define rules checking user and accessed resources attributes to handle access control.
Installation
Use composer to set the bundle as your project dependency :
Then you must load the bundle in your AppKernel file and configure it :
Documentation
Please refer to the PHP ABAC documentation
Usage
This bundle creates a Symfony service with the php-abac main class.
To check if a rule is enforced, you must define a rule in your configuration file and then check it.
A rule can check user and resource attributes or just the user's.
This is an example of configured rule:
And then in your controller :
Since 0.3.0, you can use autowiring in your controller
Overiding components
The Abac
service being autowired, you can replace any of its dependencies by reconfiguring their aliases.
For instance, if you want to implement your own CacheManager
, you just have to implement the following configuration:
Of course your component must implement the associated interface.
The overridable interfaces are:
- PhpAbac\Configuration\ConfigurationInterface
- PhpAbac\Manager\PolicyRuleManagerInterface
- PhpAbac\Manager\AttributeManagerInterface
- PhpAbac\Manager\ComparisonManagerInterface
- PhpAbac\Manager\CacheManagerInterface