The ACL bundle makes it possible to grant authorization based on resources.
Read the bundle documentation.
You can run the unit tests with the following command:
$ cd path/to/acl-bundle/
$ composer.phar install --dev
$ ./vendor/bin/simple-phpunit
Integrates the ACL Security component into Symfony applications.
Home Page: https://symfony.com/acl-bundle
License: MIT License
The ACL bundle makes it possible to grant authorization based on resources.
Read the bundle documentation.
You can run the unit tests with the following command:
$ cd path/to/acl-bundle/
$ composer.phar install --dev
$ ./vendor/bin/simple-phpunit
Is there "symfony/acl-bundle" documentation for Symfony4?
GitHub page points to Symfony documentation and Symfony back to GitHub. It looks official documentation is somehow missing.
I followed the example: https://github.com/symfony/acl-bundle/blob/master/src/Resources/doc/index.rst
`
class BlogController extends Controller
{
// ...
public function addCommentAction(Post $post)
{
$comment = new Comment();
// ... setup $form, and submit data
if ($form->isSubmitted() && $form->isValid()) {
$entityManager = $this->getDoctrine()->getManager();
$entityManager->persist($comment);
$entityManager->flush();
// creating the ACL
$aclProvider = $this->get('security.acl.provider');
$objectIdentity = ObjectIdentity::fromDomainObject($comment);
$acl = $aclProvider->createAcl($objectIdentity);
// retrieving the security identity of the currently logged-in user
$tokenStorage = $this->get('security.token_storage');
$user = $tokenStorage->getToken()->getUser();
$securityIdentity = UserSecurityIdentity::fromAccount($user);
// grant owner access
$acl->insertObjectAce($securityIdentity, MaskBuilder::MASK_OWNER);
$aclProvider->updateAcl($acl);
}
}
}
`
But after submitting the form, I got:
Service "security.acl.provider" not found: even though it exists in the app's container, the container inside "App\Controller\Web\BlogController" is a smaller service locator that only knows about the "doctrine", "form.factory", "http_kernel", "parameter_bag", "request_stack", "router", "security.authorization_checker", "security.csrf.token_manager", "security.token_storage", "session" and "twig" services. Unless you need extra laziness, try using dependency injection instead. Otherwise, you need to declare it using "BlogController::getSubscribedServices()".
I want to use this bundle in my exiting Laravel 5 application, but it seems to be dependent on the Symfony dependency container whereas all of my dependencies are managed inside Laravel's IOC containers. Am I required to use the Symfony's dependency container for getting such this
$aclProvider = $this->get('security.acl.provider');
Or I can independently register the Security ACL dependency in my Laravel container and get it from there? I don't want to keep track of two different object containers in my application.
"require": {
"php": "^5.5.9|>=7.0.8",
"ext-xml": "*",
"symfony/dependency-injection": "~3.4|~4.0",
"symfony/http-kernel": "~3.4|~4.0",
"symfony/security-acl": "~2.7|~3.0",
"symfony/security-bundle": "~3.4|~4.0"
},
Can I register the security services inside my Laravel Container? If yes what are the services that are required for the ACL bundle in order to make it work?
I've tried to update dependencies of acl-bundle to sf5 but it was unsuccessful. Since tests are broken from symfony/dependency-injection:4.4.0. Commit which affected tests -
https://github.com/symfony/dependency-injection/commit/ddb02286fb427dc6aba02cabc150f21b40aeb349
(@nicolas-grekas )
Example of error message from tests
acl-bundle/vendor/symfony/dependency-injection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php:86
acl-bundle/vendor/symfony/dependency-injection/Compiler/AbstractRecursivePass.php:82
acl-bundle/vendor/symfony/dependency-injection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php:49
acl-bundle/vendor/symfony/dependency-injection/Compiler/AbstractRecursivePass.php:91
acl-bundle/vendor/symfony/dependency-injection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php:49
acl-bundle/vendor/symfony/dependency-injection/Compiler/AbstractRecursivePass.php:82
acl-bundle/vendor/symfony/dependency-injection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php:49
acl-bundle/vendor/symfony/dependency-injection/Compiler/AbstractRecursivePass.php:46
acl-bundle/vendor/symfony/dependency-injection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php:40
acl-bundle/vendor/symfony/dependency-injection/Compiler/Compiler.php:94
acl-bundle/vendor/symfony/dependency-injection/ContainerBuilder.php:762
acl-bundle/tests/DependencyInjection/CompleteConfigurationTest.php:56
acl-bundle/tests/DependencyInjection/CompleteConfigurationTest.php:27
A tree builder without a root node is deprecated since Symfony 4.2 and will not be supported anymore in 5.0.
The "Symfony\Component\Config\Definition\Builder\TreeBuilder::root()" method called for the "acl" configuration is deprecated since Symfony 4.3, pass the root name to the constructor instead.
The composer.json allows only Symfony 6 at the moment, so the bundle cannot be install on Symfony 7 code.
Would it be possible to allow Symfony 7?
Thank you.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.