Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I would like to grant permissions (edit node permissions) to roles, for editing all nodes that have a CCK field that contains the role name.
For instance role "Chicago" should be able to edit all nodes that have a CCK field that contains the role name.
I've did lots of research on this and I feel that Permissions API is coming close to the solution I'm looking for. The problem is that my php knowledge doesn't reach to program this myself; I have a moderate knowledge of php which is not enough in this case.
How would such a code look like? Any suggestions are welcome
Many thanks
Comments
Comment #1
ebeyrent CreditAttribution: ebeyrent commentedPermissions API won't be able to help with this, I'm afraid. Roles and permissions are global, and what you need is access control on a node-by-node basis. This project may be of some help:
http://drupal.org/project/node_privacy_byrole
You will need to implement hook_node() in a custom module on the insert/update operation to create the node access entry based on the value of your cck field.
Comment #2
gotcha41 CreditAttribution: gotcha41 commentedThank you very much for your reply, I just implemented a solution that uses Taxonomy Access Control. This module doesn't require permissions to be set per node, as it sets permission based on the tag(s) a node has. (I replaced a cck field with a cck taxonomy field , which is basically a cck field that can pick tags from a taxonomy vocabulary ) Permissions are set by role, based on taxonomy tags a node has.
thank you very much for sharing your insight!
Comment #3
ebeyrent CreditAttribution: ebeyrent commentedComment #3.0
ebeyrent CreditAttribution: ebeyrent commentedmore info