Is there any module that would allow me to edit/delete nodes created by users with the same role I have?
3 Answers
I would approach this by grouping users with organic groups module instead of by role. Roles are only for defining access level, not for making groups of users.
-
I think this would be the best solution. You can use collaborative groups.– pasineCommented May 31, 2011 at 22:58
I believe rules is capable of doing that. Something like:
On node edit: If user has role: author role (any other role except authenticated user) OR admin role
let it edit. Else, redirect with message.
Of course, this is just the logic outline. You'd have to do the actual PHP code for this to work. ^^
First of all, the module that provides the content type (via an implementation of hook_node_info()) is the only authority over who may edit content of that content type. If the module chooses not to consult role based permissions, the node access table or other modules, there is not much you can do about it (except for hacking the module). A module that meets the requirements you described can therefore (in general) not exist.
If you restrict your question to those content types, that are provided by the node module (i.e. the ones that are created via the Durpal UI): every authenticated user has the role "authenticated user". A module that meets the requirements you described would therefore grant all authenticated users write access to all nodes created by an authenticated user. This can be done by granting the permission edit any $type content to the role authenticated user for every content type $type
.
This has the effect that authenticated users can also edit content created by anonymous users. I do not think this is a problem, because an authenticated user can always become an anonymous user, simply by logging out.
What remains do be done is granting anonymous users the permission to edit content of other anonymous users (yes, they are a role as well), but not content created by authenticated users. This is only a problem when you allow anonymous user to create content.