On my site, the nodes are restricted based on user's role. Admin selects any number of roles in a field (field_role
) when creating a node and if any logged in user's role matches one of the selected roles, he/she can access the node.
But this only works, when user clicks on the node and then either can see the node or see an access denied warning.
The problem is that I just don't wanna show the node, if the access is restricted. The nodes are shown through a view as a listing on home page and I am just not sure how to tell the view that if the logged in user doesn't have any of the role selected in "field_role", then filter out the node from the listing.
Any help.