[development] Writing Directly To node_access Table

Steve Edwards killshot91 at comcast.net
Fri Dec 14 06:12:29 UTC 2007


I've written a module that allows an admin to specify access to a 
project node (using the Project module) at a user level.  There is an 
admin page with a separate form for each project in a collapsible 
fieldset where the user can select which users have access for each 
project.  I'm using hook_node_access_records() and hook_node_grants() to 
write access records to node_access.  The one big problem I have is that 
hook_node_access_records is only called when the node is saved.  I would 
like to allow the admin to be able to set the access on the admin page 
and have it take effect right away, instead of then having to go in and 
save each project node for the records to be written to node_access.  Is 
there a problem with writing directly to the node_access table, such as 
in the submit function for my form?  That way, the access records would 
already be available the next time the node is access.  If I do that, do 
I have to do something like call node_access_rebuild at some point after 
the data has been written to the table?

Thanks.

Steve


More information about the development mailing list