Geting started with Drupal's node access API

Geting started with Drupal's node access API

Posted 08/06/2009 - 13:21 by State68

First thing this morning I started trying to get to grips with Drupal's node access API. The node access API allows you to fine-tune which of your users should see which nodes. My current big project has node types in which users are referenced; I wanted to be able to allow those users to see only those nodes in which they are referenced, and then only those nodes which the creating user has not flagged as being private.

I was banging my head against a brick wall until I came across this video of a session at Drupalcon Szeged 2008 in which Ken Rickard and Moshe Weitzman go through Drupal's node access system step-by-step. I'd thoroughly recommend watching the video if you want to get to grips with node access.

Also, check out the example module at http://api.drupal.org/api/file/developer/examples/node_access_example.mo....

I haven't written my module yet, but the key thing to remember seems to be that hook_node_records adds stuff to the node_access table, while hook_node_grants reads stuff from the node_access table. I might post a full tutorial when I've got my module done.

I see you offer priceless

I see you offer priceless info. Congratulations, and keep posting to us. Do have some sort of email system where your blog posts emailed to me?

Posted by Anonymous on Thu, 01/06/2011 - 10:18