The OneupAclBundle is a Symfony2 bundle which is primary tested against version 2.3 of the framework. Yet, there is the possibility that this bundle also works for version 2.1 and following.
Installation is as easy as pie! Just follow these three steps to download, install and setup the OneupAclBundle.
- Download the bundle using composer
- Enable the bundle in your AppKernel
- Configure and/or start using it
Add OneupAclBundle to your composer.json using the following construct:
{
"require": {
"oneup/acl-bundle": "dev-master"
}
}
Now tell composer to download the bundle by running the following command:
$> php composer.phar update oneup/acl-bundle
Composer will now fetch and install this bundle in the vendor directory vendor/oneup
Enable the bundle in the kernel:
<?php
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new Oneup\AclBundle\OneupAclBundle(),
);
}
To create the tables needed, run the following command.
$> php app/console init:acl
This bundles uses the underneath Acl layer, so enable it by adding the following to your security configuration.
security:
acl:
connection: default
This bundle was designed to just work out of the box. You actually don't have to configure anything, the AclBundle comes along with sane defaults.
To use the Acl features this bundle provides, just retrieve the correct manager service.
$manager = $container->get('oneup_acl.manager');
$manager->isGranted('EDIT', $object);
After installing and setting up the basic functionality of this bundle you can move on and use some more advanced features.