Read access to user's nodes based for referenced users I am trying to figure out how to provide access to nodes of the users, which have referenced users. Please note that users are referenced not from nodes, but the user profiles, so I can not use the Node access user reference module. I also can not use roles-based access modules, because otherwise there would be too many roles to create as users on this website should be able to reference unlimited users. I also can not user organic groups.

So basically users have other users referenced from their profiles. All referenced users should have access to nodes authored by the users who referenced them.
That will require custom code.

Here's one way to achieve it:

You'll need to use hook_node_view to get involved when the node is about to be rendered.  Your code should:


Check the node's author and use user_load to gain access to the referenced users
Check to see if the current user (global $user) is in the list of referenced users
Permit or deny the node view, or change how the node displays, depending on the result.