Custom node access, need to rebuild permissions for each content item created I have a module that handles node access to a custom content type with hook_node_access. Basically, an anonymous user needs to enter a passcode to view the page. Currently, I'm doing this through session variables. If they have $_SESSION['example'] set, return NODE_ACCESS_IGNORE, otherwise

drupal_goto('form');
return NODE_ACCESS_DENY;


Currently, after I create a new content item, the anonymous user will submit the code, be redirected to the content item, and then get an access denied error.

If I rebuild the permissions, the access will work properly, but not for any content items I create after the rebuild.

The Content Access module is enabled on the site. Testing locally, I have tested both disabled (not uninstalled) and enabled content access module and access is currently working as intended.
It seems like your problem matches the following:


  This function is called when a node is saved, and can also be called by modules if something other than a node save causes node access permissions to change.


This is an excerpt from the node_access_acquire_grants documentation.
I believe a way to go about your problem would be to call this function, inside your form_submit handler (guessing you have one).

So, on a conceptual level, as soon as the anonymous user enters the code, the node access permissions for that specific page changes and you should update them (writing them to the database) through a call to node_access_acquire_grants

Good luck, let us know how this goes!