[Sonata Beginner] - Sonata Demo ROUTES/PERMISSIONS How to leverage functionality.

143 views
Skip to first unread message

Ryan Walega

unread,
Nov 5, 2013, 5:24:43 PM11/5/13
to sonata...@googlegroups.com
I have recently been looking deeper into Sonata bundle and I am struggling a lot with the documentation and the demo. I installed the demo locally and have been working with it thus far.

** Please forgive me if the questions are incomplete. I am struggling to learn to ask the right questions to find the answers I am looking for. And as I understand Symfony and Sonata better that is improving.

[QUESTIONS]
  1. The demo implies all the permissions that can be set for the users only affect how users interact with the admin dashboard. But what confuses me is that the demo does not seem to demonstrate how non admin users interact with the system when they login.
    • How do you add more roles? So that I can assign them to other users as they login and interact with the system normally.
    • I see that the Admin bundle relies on this model class Admin. All of my users will not be admins, what is the design behind this Admin class?
  1. In the code for the twig templates I can see code the is checking 'if admin.hasRoute('export') and admin.isGranted("EXPORT")'  to evaluate if the admin user has a given route and if that admin user has the export permission (which I cannot find under the roles section for a user).
    • So where is the routes being set for a given user based on the permissions?
    • Where can the EXPORT permission be set?
  1. Ultimately, I need to manage admin users and normal users and govern the permissions of each of those users. The permissions would regulate access to your CRUD operations like CREATE, VIEW, UPDATE, DELETE and maybe a few other ones. Furthermore, if there is a way to associate routes to a user based on permissions I can see that being very helpful as well. But I'm confused on what value the Admin and associated bundle provides. 
    • How do you leverage Sonata Admin bundle to do those things I just listed?


Cassiano Tartari

unread,
Nov 6, 2013, 5:51:24 AM11/6/13
to sonata-users
Let's try.


On Tue, Nov 5, 2013 at 8:24 PM, Ryan Walega <ry...@code200designs.com> wrote:
I have recently been looking deeper into Sonata bundle and I am struggling a lot with the documentation and the demo. I installed the demo locally and have been working with it thus far.

** Please forgive me if the questions are incomplete. I am struggling to learn to ask the right questions to find the answers I am looking for. And as I understand Symfony and Sonata better that is improving.

[QUESTIONS]
  1. The demo implies all the permissions that can be set for the users only affect how users interact with the admin dashboard. But what confuses me is that the demo does not seem to demonstrate how non admin users interact with the system when they login.
    • How do you add more roles? So that I can assign them to other users as they login and interact with the system normally.
    • I see that the Admin bundle relies on this model class Admin. All of my users will not be admins, what is the design behind this Admin class?
The roles are generated automatically for each admin class. You can create role_hierarchy in the security.yml

I don't get the second question.

 
  1. In the code for the twig templates I can see code the is checking 'if admin.hasRoute('export') and admin.isGranted("EXPORT")'  to evaluate if the admin user has a given route and if that admin user has the export permission (which I cannot find under the roles section for a user).
    • So where is the routes being set for a given user based on the permissions?
    • Where can the EXPORT permission be set?
The export, if I'm not wrong is inside the _MASTER role. You can remove from some admin using:

    protected function configureRoutes(RouteCollection $collection) {
        $collection->remove('export');
    }


 
  1. Ultimately, I need to manage admin users and normal users and govern the permissions of each of those users. The permissions would regulate access to your CRUD operations like CREATE, VIEW, UPDATE, DELETE and maybe a few other ones. Furthermore, if there is a way to associate routes to a user based on permissions I can see that being very helpful as well. But I'm confused on what value the Admin and associated bundle provides. 
    • How do you leverage Sonata Admin bundle to do those things I just listed?
You can make something using group of roles and set these groups to this users.


 


--
You received this message because you are subscribed to the Google Groups "sonata-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonata-users...@googlegroups.com.
To post to this group, send email to sonata...@googlegroups.com.
Visit this group at http://groups.google.com/group/sonata-users.
For more options, visit https://groups.google.com/groups/opt_out.

Cassiano Tartari

unread,
Nov 6, 2013, 6:37:02 AM11/6/13
to sonata-users
Just one more thing, you can customize the role handler extending or creating a new one (Sonata\AdminBundle\Security\Handler\RoleSecurityHandler) and setting it in the sonata_admin section of config.yml

sonata_admin:
    security:
        handler: sonata.admin.security.handler.role

Cassiano Valle Tartari
MSc. Computer Engineer

Tel: +55.48.84474818
Email: fal...@cassianotartari.eng.br
Site: http://www.cassianotartari.eng.br

QR Code
Reply all
Reply to author
Forward
0 new messages