symfony - SonataAdminBundle: set permission depending on field value -
i have working sonataadmin+fosuser (without sonatauserbundle) setup roles , acl enabled. working fine, every user has access different admins depending on roles.
now need go bit deeper. restrict access 1 of admin depending on value of association of underlying entity.
lets have this:
/** * @orm\entity */ class content { /** * @var string * * @orm\manytoone(targetentity="contenttype", inversedby="contents") */ private $type; } /** * @orm\entity */ class contenttype { /** * @var string * * @orm\column(name="name", type="string", length=255) */ private $name; }
i following:
- users role_xxxxx : have access contents content type name 'xxxxx'
- users role_yyyyy : have access contents content type name 'yyyyy' ...
of course means when creating new content or filtering list of contents, users should not able select content type on don't have permission.
i have tried no luck:
php app/console acl:set --role=role_xxxxx master mybundle/contenttype:2
Comments
Post a Comment