Answer the question
In order to leave comments, you need to log in
How to differentiate rights in Symfony2 for REST API routes?
Installed FOSUserBundle.
Default security settings for routes:
/* app/config/secutiry.yml */
access_control:
- { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/admin/, roles: ['ROLE_ADMIN'] }
- { path: ^/, role: IS_AUTHENTICATED_REMEMBERED }
/* app/config/secutiry.yml */
access_control:
- { path: ^/api/entity/delete$, roles: ['ROLE_ADMIN'] }
- { path: ^/api/entity/create$, roles: ['ROLE_ADMIN'] }
- { path: ^/api/entity/update$, roles: ['ROLE_ADMIN'] }
/* app/config/secutiry.yml */
access_control:
- { path: ^/api/admin/, roles: ['ROLE_ADMIN'] }
Answer the question
In order to leave comments, you need to log in
- { path: ^/api/\w+/(create|update|delete)$, roles: ['ROLE_ADMIN'] }
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question