juba
juba

Reputation: 49033

Give edit permissions to roles based on taxonomy and content type

I'm looking for a way to manage edit permissions on Drupal 6 nodes based on the content-type of the node and on his taxonomy.

For example, I'd like to be able to allow a role to edit stories of taxonomy1 and pages of taxonomy2 but not stories of taxonomy2 and pages of taxonomy1.

I know how to restrict access by content type or by taxonomy (with the taxonomy access permissions module), but I can't manage to grant permissions on both of these criteria. I would greatly appreciate a module suggestion or some ideas on how to make it programmatically.

Thanks in advance for any hints !

Upvotes: 2

Views: 675

Answers (1)

Gokul N K
Gokul N K

Reputation: 2458

function hook_menu_alter(&$items) {
   $items['node/%node/edit']['access callback'] = my_permission_function;
}

function my_permission_function($node){
  if( (node_type is 1 and tax_of_node is tax2)|| (node_type is 2 and tax_of_node is tax1)
     return TRUE;
  else return FALSE;
}

Not the exact code. Follow the logic. Try something like this and it should work.

Upvotes: 1

Related Questions