How to change role hierarchy storage in Symfony2?

前端 未结 6 1230
醉话见心
醉话见心 2020-12-22 21:32

In my project I need to store role hierarchy in database and create new roles dynamically. In Symfony2 role hierarchy is stored in security.yml by default. What

6条回答
  •  一整个雨季
    2020-12-22 21:56

    I hope this will help you.

    function getRoles()
    {
    
      //  return array(1=>'ROLE_ADMIN',2=>'ROLE_USER'); 
       return array(new UserRole($this));
    }
    

    You can get a good idea from, Where to define security roles?

    http://php-and-symfony.matthiasnoback.nl/ ( 2012 July 28 )

提交回复
热议问题