i'm little confused..
I'm using sonata admin bundle in my project and i'd like to install user management for this, tell me please do i really have to install sonata user bundle? (i was using this tutorial http://domitable.com/content/getting-started-symfony-23-sonata-admin-user-bundles ) or only fos user bundle will be enought? i'm asking this becouse i want to install as little dependiendes as possible.
honestly the best way for me would be to use only my custom user bundle with custom user entity..(if need be only my class + FOS)
Do i have to use easy-extends to generate my user entity class or default doctrine generate entity is okay?
What about sonata ACL in this sitaution?
what is the best way to resolve this issue?
I'll try my best with what I have. Basically, SonataUserBundle is only useful if you want to manage the users via SonataAdmin.
FosUserBundle is simply a bundle that manages users and some actions such as login, but from the point of view of a user. That is, it does not have the tools built in for an admin to manage users.
Therefore, to manage the users, you need SonataAdmin and SonataUser.
If you easy extends SonataUser, then you could transfer your custom entity in the extended bundle. That is a way you could do it.
ACL is a complete different thing, read here for more information:http://symfony.com/fr/doc/current/cookbook/security/acl.html
Related
I am doing a back office under symfony and easy admin bundle and FOSUserBundle. I would like to know if it was possible when the admin connects in his space, he sees only the normal users, which do not have the role admin only.
or separate administrators from normal users.
I ask the question because using Sonata I know it's possible, but since I have to do it under easyadmin I do not know if it's feasible.
I have been trying to do this for a while now and I would like to know if it was possible.
Merci d'avance :)
In easy admin bundle you can filter entities with a DQL FILTER see the documentation here
You can use this for dislplaying only normal users.
you can try this filter:
dql_filter: "entity.roles NOT LIKE '%%env(ROLE_ADMIN)%%'"
as you seem to be French-speaking, here is a very interesting article about easyadminbundle
I'm a beginner with Symfony and with FOSUserBundle. I succeeded to install FOSUserBundle and created a user that inherits from FOSUser. But now I have other types of users that I want them to have their own attributes. That means that I want them to have their own classes and tables in the DB. Should I inherit from FOSUser again or should I inherit from my existing user? I have no idea where I should start from. Any help please?
I used sonataadmin and really like some features, like creating an entity and its related entity in the same page. I want to use it for frontend user also. Is it possable to use sonamaadmin for both backend and frontend users? Or is there another bundle allowing me to create an entity and its related entity in the same page?
Those are just form types, provided by the SonataAdminBundle. You can use them in any form.
You probably looking for the sonata_type_model or sonata_type_collection. See the documentation for more information.
Of course you can use Sonata Admin in both, although will be like only having a backend and made the correct security configuration for two kind of users. About entity and its related entities in the same page, that has nothing to do with Sonata, this can be achieved with symfony simple and embed forms.
i want to implement a social share functionality in sonata admin bundle Symfony2. Whenever a editor created an article and published it that will automatically share on facebook or twitter.
Just want to know that is any bundle available which has social share functionality???
Last option
if bundle is not available then i have to made my own bundle
There is no social network API implementation in the Sonata suite at the moment, beside referencing through the SonataSeoBundle (http://sonata-project.org/bundles/seo/master/doc/reference/installation.html).
We are interested in adding this feature in the Sonata bundles, feel free to discuss it with us by creating an issue on github.
Only for Sonata Admin No. specific bundle.
You can try this in your back-end :
Facebook Bundle
Twitter Bundle
Or
try this Bundle :
https://github.com/hwi/HWIOAuthBundle
Maybe this is helpful to you.
There is here an article, maybe it helps: http://obtao.com/blog/2012/11/create-a-social-buttons-bar-for-facebook-twitter-and-google-with-symfony2/
I have Sonata Admin set up with ACLs. I have different users, groups and permissions which work fine. To achieve this, i followed the Sonata Admin documentation on ACLs.
So here is my question: What is a clean way to ensure that backend (admin) users can only view, edit and delete the entities they created with Symfony's and Sonata Admin's built-in ACL mechanisms? Sonata Admin automatically stores the owner (creator) of the object once it is persisted in the ACL tables (from the Sonata docs):
Owner:
when an object is created, the currently logged in user is set as owner for
that object and is granted all access for that object;
The same question has already been answered on Stackoverflow, but the answer does not explain in detail how to solve it with ACLs.
There is a new Symfony bundle doing just that: https://github.com/coopTilleuls/CoopTilleulsAclSonataAdminExtensionBundle
All you need to do is enable ACL in Sonata Admin, install the bundle and activate it. Pretty easy and effective, I use it in my Symfony2 project with Sonata Admin 2.2.
I saw 2 ways to do that:
Create a custom AclVoter
Override your Admin Class' CreateQuery()
I was not able to do any of these for doing the very simple thing that I needed, but I think this is the idea.
Actually this is one of many Symfony things on which I spent many hours and thousands lines of code without big success... Such simple needs should not be as much pain in the arse...
Don't grant the EDIT permission to the users. They can edit the instances they own but not others' instances.
I use this configuration:
#app/config/config.yml
sonata_admin:
security:
information:
STAFF: [VIEW, LIST, CREATE]
EDITOR: [OPERATOR, EXPORT]
ADMIN: [MASTER]
Documentation