Limiting node access to certain users based on an entity reference field. Which hook to use for when node is viewed?
In similar situation I used hook_entity_access. Also there is hook_ENTITY_TYPE_access so you can use the hook_node_access.