docs/4.Providers.md
# Providers
`Eye4web\Zf2Abac` uses providers to get permission groups. You're able to use our providers or to create your own.
## Doctrine ORM
You can use the Doctrine ORM Provider to handle all permissions through your database.
### Database structure
The database scheme is located in `data/scheme.sql`
Table: `abac_permissions`
| id | name | value | valueId | group | validator | validatorOptions |
|-----|-------|-------|-----------|-------|-------------|------------------|
| 1 | board | vip | role | 1 | GreaterThan | {"min": 2} |
This is an example on how to create a permission. Here is the more detailed description:
* **name**: Name of the access group
* **value**: Specific access area
* **valueId**: This is what we are going to validate
* **group**: Permission group
* **validator**: Name of the validator <sup>1*</sup>
* **validatorOptions**: Options for the ``Zend\Validator`` in JSON-format <sup>2*</sup>
1) See the full validator list here: [ZF2 Documentation: Standard Validation Classes](http://framework.zend.com/manual/2.2/en/modules/zend.validator.set.html)
2) [JSON on Wikipedia](http://en.wikipedia.org/wiki/JSON)
## Creating your own provider
If you want to create your own provider, all you need to do is implementing `Eye4web\Zf2Abac\Provider\ProviderInterface`.
After that all you need to do is to inject/depend on your own provider in the assertion where you will be using it.
* Continue to [**Using the Authorization Service**](/docs/5.Using the Authorization Service.md)
* Back to [the Index](/docs/README.md)