Hello,

I just installed nodeaccess on drupal 5 and it doesn't think to do what I expected it to do...

I configured the defaults to allow everyone (all roles) to be able to view any content type. After that, I opened my website without being logged in and I couldn't access a thing. I tried logging in as a user member of at least one role (instead of admin), which should have view rights by default and still nothing.

Am I missing something in the configuration ? Apparently, this module works for some people so I guess I'm doing something wrong, but I really can't figure out what ! Oh, if I explicitely define grants for a node, apparently it seems to work fine. But the defaults are not taken in account...

acp

Comments

justus’s picture

I've noticed the same problem in my installation.

Souvent22’s picture

Ditto. Same problem. I'll try and take a look, hopefully someone else finds a fix soon though. Nice module though.

peterdeitz’s picture

I have the same problem. Worse yet, I uninstalled nodeaccess, but whenever I update a node as administrator, anonymous users get 'access denied' messages. This means that each time I 'update' something I actually take it offline. Please help.

Anonymous’s picture

I'm unable to reproduce this problem. The only way I can investigate further is if you can provide access to your system or send me a database dump and site tarball to chad@confluencewebservices.com along with the steps required to reproduce this problem.

Anonymous’s picture

Status: Active » Fixed

AH ok I found it. I was giving the permissions for node authors a higher priority so they'd win over the other perms set, however I forgot that when doing this drupal just ignores perms of a lower priority, so all it considered was the author permissions and not the user/role permissions. I've set them to all have the same priority so should be fixed soon, whever drupal repackages the module (should be sometime on the 27th).

Souvent22’s picture

I just downloaded the newest CVS from the Drupal-5 tree from the repo, and I'm not having the issues mentioned above where everything is getting access denied. :-/

WebWeasel’s picture

I tried the CVS version after trying the last dev version. Same problem, can't access any nodes.

Anonymous’s picture

Ok it would help if I actually fixed it. New version just committed, should be packaged up within 24 hours and I 97.83469242% guarantee it's fixed now.

Souvent22’s picture

Thanks man. :). No worries. I'm a dev. too, I know how these things go.

WebWeasel’s picture

I just tried it from CVS and it's working now. Yea!

ahaze’s picture

I just installed the development snapshot http://drupal.org/node/119861 and it still has this problem. Even though I've set the defaults to everyone can see everything, nobody can see anything until I change grants on individual nodes. I'm working on a test site which I've upgraded from 4.7 to 5.1 here: http://deandi.com/dev

Even though I have nearly 400 nodes, the only one visible is the test node created for this module. If it makes any difference, I was previously using node privacy by role. When I tried installing the patched version for 5.1 I got the "Welcome to your new Drupal website" error and had to reset my node_access table- at that point I disabled and uninstalled npbr and installed nodeaccess. And here we are. Any ideas? Thanks in advance.

ahaze’s picture

Status: Fixed » Active
ahaze’s picture

Status: Active » Closed (fixed)

Never mind. I messed with the node_access table some more, found that I hadn't deleted npbr as I thought I had, and all is now well. Thanks for this great module!

acp’s picture

Status: Closed (fixed) » Active

Hi there,

I tried the last snapshot and it doesn't seem to work for me. Am I the only one still having this issue (in which case I should check my installation, although everything else runs smoothly) ?

I'm setting view rights to anonymous users for all types of contents, and when I load the frontpage, I get the Drupal greeting normally displayed on a fresh installations. Accessing any node results to an access denied message.

Once again though, setting individual grants (per node that is), it works fine.

Any clues ?

Anonymous’s picture

As far as I can tell everything is working fine. Without seeing your installation and database I couldn't say why it's not working for you. The secret lies in the nodeaccess table and what all is in there... But it's all working fine for me, and seemingly everyone else as well.

scooper@drupal.org’s picture

I have the same problem, IF in the nodeaccess module I check "give node grants priority". Then my anonymous users can't see a thing except the Welcome page. I do have "View" checked for anonymous users in nodeaccess (both story and page).

If I uncheck "give node grants priority" then anonymous users see all the pages again.

oriol_e9g’s picture

The same problem. If I don't check the cheackbox "Give node grants priority" works fine.

Anonymous’s picture

Works fine for me on all of my sites, if anyone would like further diagnosis you'll need to either give me shell access to the affected installation or zip up the site and database dump and send to chad@confluencewebservices.com

I can't reproduce the problem so without more info I don't know what to say...

Anonymous’s picture

Ok I had an email configuration issue, so in case somebody emailed me something, you'll need to send it again...

acp’s picture

Hi,

since I'm doing the installation on a "semi-"production site, I'll make local installation and send you a dump afterwards...

Thanks for your help...

acp’s picture

Small update, I still had a problem, whether "give node access priority" was selected or not. Completely uninstalling the module did the trick... at least half-way, I still have problems when I check the mentioned box, as detailed in the previous posts.

Will be sending you a dump soon...

rar’s picture

Here I think is the problem. I'm just getting into this but if we look at nodeacess_nodeapi

function nodeaccess_nodeapi(&$node, $op) {
  global $user;

  switch ($op) {
    case 'insert':
    $grants = $user->nodeaccess_defaults ? $user->nodeaccess_defaults : variable_get('nodeaccess_'. $node->type, array());

    // add author grants
    // this is duplicated below in nodeaccess_node_access_records, probably should fix that huh
    $author_prefs = variable_get('nodeaccess_authors', array());
    $agrant = $author_prefs[$node->type];
    if ($agrant['grant_view'] || $agrant['grant_update'] || $agrant['grant_delete']) {
      if (variable_get('nodeaccess-priority', 0)) {
        $priority = 1;
      }
      else {
        $priority = 0;
      }
      $grants[] = array(
        'realm' => 'nodeaccess_author',
        'gid' => $node->uid,
        'grant_view' => $agrant['grant_view'],
        'grant_update' => $agrant['grant_update'],
        'grant_delete' => $agrant['grant_delete'],
        'priority' => $priority
      );
    }

    node_access_write_grants($node, $grants, 'nodeaccess_rid');
    break;
....

Notice that when a node is created ONLY the author permissions are set. Not the permissions for others.

To set permissions for the defaults for NON-AUTHORS we'd also need

$grants_others = array(
  'realm' => 'nodeaccess_rid',
  ....
);

node_access_write_grants($node, $grants_others, 'nodeaccess_rid');

@debtman7
To reproduce this just create a node and then look at the table node_access. Note that it only creates
rows with realm=nodeaccess_author and none for realm=nodeaccess_rid.

As an aside - I set http://drupal.org/node/141421 as a duplicate of this problem. If that's an error - we can unlink that.

rar.

Anonymous’s picture

Status: Active » Fixed

uploaded fix a few hours ago, should hit drupal.org soon

rar’s picture

I tested it and it works great. I like the fact that now you are no longer populating table node_access with every node as I could see that old method as one that could slow down a large site over time. Good work!

Anonymous’s picture

Status: Fixed » Closed (fixed)