thank you for your response. But this not work for me. I have a group of people that need to access the posts by role. Are the employees of a company. But, into this site is possible that exists posts created by other persons (out of company) that uses another role profile.
So, if your plugin no have this feature, may be a good idea to do because groups os users could share each other some posts, as in my case.
If you have another suggestion of how to do it, please, share.
Replace ‘author’ role with your role id, like ‘role_b’. Do not forget to add ‘edit_others_posts’ capability to role_b role in order it can edit posts from other authors. Only posts from users with role_b role will be available for editing for any user with role_b role with this code applied.