I have successfully installed FOSComentBundle
on my symfony2.3 project.
I have integrated FOSCommentBundle with FOSUserBundle, then I added the role based ACL security.I have seen that the actions that can be controlled are :create,view,delete,edit
.
I want to show the reply button only for admin, But I haven't found how to add access role to the reply event.
This is my config file:
acl: true
service:
acl:
thread: fos_comment.acl.thread.roles
comment: fos_comment.acl.comment.roles
vote: fos_comment.acl.vote.roles
manager:
thread: fos_comment.manager.thread.acl
comment: fos_comment.manager.comment.acl
vote: fos_comment.manager.vote.acl
acl_roles:
comment:
create: IS_AUTHENTICATED_ANONYMOUSLY
view: IS_AUTHENTICATED_ANONYMOUSLY
edit: ROLE_ADMIN
delete: ROLE_ADMIN
thread:
create: IS_AUTHENTICATED_ANONYMOUSLY
view: IS_AUTHENTICATED_ANONYMOUSLY
edit: ROLE_ADMIN
delete: ROLE_ADMIN
vote:
create: IS_AUTHENTICATED_ANONYMOUSLY
view: IS_AUTHENTICATED_ANONYMOUSLY
edit: ROLE_ADMIN
delete: ROLE_ADMIN
Is there any class that I have to override? Is there any docs for the reply button?
After looking into the
FOSCommentBundle
, I have found a solution for my problem :1. first, you have to override the
RoleCommentAcl
: by creating a folder named Acl into MyBundle. Inside this folder I create a php class named RoleCommentAcl :}
2. Then you have to add into services.xml the access permissions:
PS: If you are using service.yml you can translate this xml file into yaml but if you want to use the
services.xml
you have to change the configuration sets into the DependencyInjection of your bundle:Open your page and you will notice that the reply will be accessed just by comment owner and admin users.Also the delete and Edit can be shown just for comment owner and admin.