[development] Writing Directly To node_access Table

Moshe Weitzman weitzman at tejasa.com
Fri Dec 14 15:24:31 UTC 2007

for your own custom site, thats fine. for Contrib, thats a problem  
becuase you don't know what other node access modules are running.  
Their grants might have higher priority. I guess you could ship your  
module with a hook_requirements() that yells if another node access  
module is found.

On Dec 14, 2007, at 1:12 AM, Steve Edwards wrote:

> 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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2421 bytes
Desc: not available
Url : http://lists.drupal.org/pipermail/development/attachments/20071214/505da730/attachment.bin 

More information about the development mailing list