Hi, i am building a module that needs to restrict access to content based on rules, so before each node is loaded into any view or node page or anywhere in the site, it needs to check a rules table and decide if the user has access or not. I thought hook_access was meant for this but it seems its only available for content types that the module provides.. the implementation should not have a big impact performance.. any ideas?

Thanks in advance

Comments

The ACL module might provide

The ACL module might provide an API into core for this type of application. There's also the Content access module (which can exploit ACL). In the project page, its author claims

Furthermore the module provides conditions and actions for workflow-ng / rules, which allows one to configure even rule-based access permissions.

Thanks for the help marquardt

I did see this module before, it creates lists of users and gives node access to the lists.. but the rules i create are based on taxonomy. So for example Term 1 has a set of rules, so all content tagged with Term 1 has to go through a rule verification process where all rules must return true for the user to be able to see that content (even in node listings). Using ACL means i need to create lists of users for each term and rewrite the lists every time the rules are changed or any parameters used in the rules are changed like when the user changes his birthdate.. I am trying to avoid this. A solution i was thinking on is using the sql_rewrite hook to rewrite all queries for node listings, so for each rule i have ill need to create a statement to add to the query... that way performance wont be an issue... im just not sure how complicated the implementation could be..