I am about to hide some fields instead of just deny the request when a user doesn't have access to a node.
What I am doing now is trying to postpone the permission check process to theme hooks. I created a module with hook_node_access to return NODE_ACCESS_ALLOW for all views. However, I cannot check the permission later in other place like template.php or modules.
I used
module_invoke('nodeaccess', 'node_access', $node, $op, $account);
but this only return NULL. How can I use this permission checking mechanism programmatically? Thank you!
Comments
Comment #1
leetom commentedHere is what I am doing now:
use _nodeaccess_get_grants($node); to get the grants array, then compare this with users' roles. If there is grant, then label the node by adding a new attribute. Then return NODE_ACCESS_ALLOW and check the new attribute in theme files.
This solved my question, although not so graceful.
Comment #2
alison(issue queue housekeeping)
Thank you for reporting and sharing back! I'm going to close, but anyone who's interested should feel free to re-open or open something new with other ideas for handling this info.