I'm looking for a way to to give capabilities to custom roles that only affect their level role or lower role, but not higher roles.
Example: allow editors to edit posts from editor, authors, contributors and subscribers BUT not admin.
Another example: allow editors to moderate comments only on posts that have been published by other editors, authors, contributors and subscribers but not admin's posts.
In fact, I need to have a hierarchy of capabilities that prevent a role to use its capabilities on higher role.
I tested role plugins but didn't find one that allows this function. Do you have an idea?