I have created a content type that only logged user with specific roles are able to visit or edit it.
but in some cases I wanna give permission to anonymous user to visit specific node. for this issue, I made a form with hook_menu and anonymous user insert user/password and inserted information is correct, in form submission I set a session variable and send the anonymous user to node page (node/$nid) via drupal_goto function. Also I have made hook_node_access function with suitable conditions to give access or not.
I expected that hook_node_access function called but I forced that when user is anonymous this hook is not called!! Only when a user is logged this function called!!
is there any way to give permission to anonymous user in order to visit a specific node id page after form submission?