As a freelancer and with my company, Les-Tilleuls.coop, I built many applications relying on Sonata bundles for Symfony. I especially recommend the Admin generator and the Media manager.
As these components help me to build apps with ease and speed, it’s a fair reward to contribute back to them when I can. In addition to being the author and maintainer of the Doctrine MongoDB ODM compatibility layer of the Admin Bundle ; I’ve recently added some useful features to the Sonata Project and it’s time to give them more exposure.
ACL editor for the Admin Bundle
The ACL component of the Symfony framework is as powerful as complicated. The Sonata Admin bundle provides a useful integration with it allowing to restrict actions to authorized users only. What was missing was an interface to set the permissions. I’ve fixed that and this ACL editor is now provided with the Admin bundle. This is now matter of a click for an admin to give rights to users on entities.
If you want to use this feature in your project, refer to the Sonata Admin documentation that have been updated accordingly.
ACL list filtering for the admin
This is a perfect complement to the ACL editor previously described.
I’ve built a bundle called CoopTilleulsAclSonataAdminExtensionBundle (distributed separately) providing a Sonata admin extension that filter lists of entities. Only entities that the logged in user as the right to interact with are displayed.
It also works with the ACL system of the Symfony security component. The documentation is provided with the bundle.
Confirm dialog to avoid losing unsaved changes
A common pitfall with web apps is that when a link is clicked, unsaved data entered in a form is loose without warning. Thanks to the integration of my small confirmExit plugin for jQuery, the Sonata Admin no longer suffers of this flaw. This feature can be disabled through a configuration parameter.
My jQuery plugin internally use the useful Window.onbeforeunload Javascript event
.
Integration of Sonata Media in CKEditor
The Sonata Media manager is the most powerful way to manage images, videos and files in Symfony powered applications. It supports YouTube, Vimeo and Dailymotion videos out of the box, image thumbnail generation and Amazon S3, FTP and CDN storage systems. It is highly extendable and is provided with a customized Sonata Admin UI.
What I missed was the ability to select and upload Media directly from CKEditor, the popular WYSYWG visual text editor. Those features is now available as a separate bundle (when I have time, I’ll move it directly in the SonataMedia bundle). The CoopTilleulsCKEditorSonataMediaBundle bundle allows to:
- Upload an image through Sonata Media directly form the CKeditor’s image dialog
- Select an existing Sonata Media file
- Create a link to a media handled with Sonata through the CKeditor’s link button
- Upload a file from the CKEditor’s link dialog
As always, the doc is included with the bundle.
I’ve also make some bug fixes on SonataAdmin, SonataMedia, SonataPage and SonataDoctrineORMAdminBundle. Hoping these enhancements will help some Symfony developers!
Hi there,
The ACL editor is really great, thanks for it 😉
I want to manage rights per user groups, or per ACL roles, instead of per user as it’s now. Do you know how to do this?
Thanks
Hi iSam,
Groups and roles are not currently supported in the UI. However, I’ve built a command to set them. It is currently awaiting to be merged in Symfony: https://github.com/symfony/symfony/pull/9990
You can inspire you from the command’s code to enhance the UI. If you manage to get something cool, send a PR to the Sonata Admin GitHub repository!