If I'm right understand Drupal node access system following things have a place.

If {node_access} table have no record
(nid=0, gid=(this user some_realm gid), realm='some_realm', grant_view = 1)

node can be viewed only if {node_access} have following record
(nid=(this node id), gid=(this user some_realm gid), realm='some_realm', grant_view = 1)

So records where all (grant_view = 0 and grant_view = 0 and grant_view = 0)
actually not needed at all. Actually only records which grants some permission affect node_access() behaviour.

But taxonomy_access produce ton's of such stub records for every (user_role, nid) pair.
In the site I'm creating now, using taxonomy_access, most of nodes invisible for anonymous user
and taxonomy_access produce (number_of_roles) records in {node_access} table for every node.
And this records grants no permissions at all.

Im suggest chage several following lines in taxomomy_access.module

<?php
db_query('INSERT INTO {node_access} ... ' ... , $some_variable->grant_view, $some_variable->grant_update, $some_variable->grant_delete);
?>

to

<?php
if ($some_variable->grant_view || $some_variable->grant_update || $some_variable->grant_delete){
    db_query('INSERT INTO {node_access} ... ' ... , 
                $some_variable->grant_view, 
                $some_variable->grant_update, 
                $some_variable->grant_delete);
}
?>

I'm can do this and send patch.
May be I'm miss somefing and exists some reasons do not do it?

Comments

keve’s picture

Thanks for the suggestion. It is a good idea.

As far as i know, you are right about node_access. But i have to review it for 100% :)
I have not thought about this.

keve’s picture

I reviewed node_access function. These lines with 0s in table node_access are unneccesary.

I also checked my site, 5000 from 25000 lines in the table 'node_access' are filled with
0s for grants. Yes, we should do it. it is a very good idea.

keve’s picture

Status: Active » Fixed

Commited to HEAD.

Anonymous’s picture

Status: Fixed » Closed (fixed)