Someone knows how to set the nodes of a specific content type visible only for the node owner and eventually for a specific user role? I've tried the "private" module, but it doesn't work with taxonomy access control enabled.

thanks!

Comments

Dan DG’s picture

I use http://drupal.org/project/node_privacy_byrole - I don't know how it interacts with taxonomy access control though.

finex’s picture

It's only for 4.x, I'm using 5.x. But I should try to check the code.. thanks.

Dan DG’s picture

Sorry - I hadn't noticed there's still not an official 5.x version

I'm using Drupal 5.1 and the HEAD version of this module without any problems. HEAD version is here: http://drupal.org/node/106122

finex’s picture

I've partially resolved my problem. 'Resolved' because now drupal do what I want, 'partially' because I've added some code to the node.module, so, when I'll upgrade drupal, I'll need to repatch the module. I've added some code to the "node_content_access()" and two perms on the "node_perm()":

On the node_perm()

$perms[] = 'view only own '. $name .' content';
$perms[] = 'view all '. $name .' content';

On the node_content_access() i've append after the existing code:

if ($op == 'view') {
  if (user_access ('access content') ){

    if (user_access('view only own '. $type .' content')) {
      if ($user->uid == $node->uid || user_access('view all ' . $type .' content' ) ) {
        return TRUE;
      } else {
        return FALSE;
      }
    } else {
      return TRUE;
    }
  } else {
    return FALSE;
  }
}

Is it possible to write a module for this code?

Linuk’s picture

too many returns :) little modification

if ($op == 'view') {
  if (user_access ('access content')&&user_access('view all '. $type .' content')||user_access ('access content')&&user_access('view only own '. $type .' content')&&($user->uid == $node->uid)){
    return TRUE;
  }else{
  	return FALSE;
  }
}