Drupal Node Access Explained

Jun 11, 2008

Drupal's API contains a pretty good description of how node access works (developers should also analyze the node_access function itself). There are many contributed node access control modules for Drupal and you really should understand the basics of node access before installing and configuring one. The API should suffice for developers but for the benefit of our many community members who build sites without reading code, here is a translation and some basic rules of thumb:

  • In general, you don't want to use more than one node access module on your site. There are many node access modules to choose from: taxonomy access, nodeaccess, simple access, workflow access, etc. We all tend to add lots of modules to our sites and to expect them to play well together, but node access is an area where we need to be extra thoughtful.
  • Users with permission to 'administer nodes' are never restricted by node access modules. Users who do not have permission to 'access content' will never gain access from a node access module. Only users who have 'access content' and not 'administer nodes' are eligible for the wild world of node access module control.
  • If a user's role has permission to create or edit a content type, or to edit their own posts in that content type, that ability will always be allowed regardless of your node access module's configuration. Delete access is included in the 'edit' permission. If you want to control creating, editing, or deleting of your nodes with a node access module, be sure to not give your users these permissions in the permissions table.
  • If your content type comes from an additional module (forum, event, etc.) other than cck, it may have its own permissions to set. Giving a role these permissions will also supersede the use of any node access module.
  • Node access modules always GRANT access and never restrict it. (It is a whitelisting rather a blacklisting system.) If you use two node access modules and one grants access while another does not, access is granted. This may be backwards from what some people would assume and is the reason why it is tricky to get involved with multiple node access modules. It is possible to use multiple node access modules in harmony however if for example they are applied to different content types or are giving out different grant types.
  • The four types of possible grants on a node are: view, update, create, and delete. You can use Devel module's devel_node_access to analyze a node's node access grants. (Doing so as a non-developer is a good sign that you've gotten into trouble with your node access modules and may need to follow the above advice!)
  • The node access table in the database can become confused if you have, for example, toyed with multiple node access modules or come into contact with a deranged one. If you have been involved with risky node access behaviors you should rebuild your permissions. You can find this option at admin/content/node-settings which is the 'Post Settings' configuration screen. It is rarely necessary.

Related posts

Jun 6, 2014 | Posted by: David Hamme
We are excited to annouce that Zivtech CEO Alex Urevick-Ackelsberg will be discussing the future of Drupal in business on a panel with other local Drupal shops including Context, Rock River Star, and Tabula Creative.    Businesses have long been searching for a platform that empowers...
Mar 24, 2014 | Posted by: David Hamme
Are you an aspiring web developer, fresh out of college and eager to dive into Philly’s exploding tech startup scene? Are you a growing startup or established company in need of talented developers to help take your business to the next level?   Zivtech was thrilled last week when...
Mar 10, 2014 | Posted by: Jason Moore
Hi, my name is Jason Moore and I am a Developer here at Zivtech. I recently started working for Zivtech full time, helping their talented team continue to build and maintain awesome Drupal websites and applications for their clients. For the three years prior to joining Zivtech, I built a name for...
Nov 5, 2013 | Posted by: David Hamme
A salute to the unsung modules that make our jobs a little easier. We at Zivtech have been working with Drupal for a long time, some of us for over 10 years, and in that time we’ve gotten to use (and sometimes build) a lot of really cool modules to develop stellar sites for our clients. We...
Sep 26, 2013 | Posted by: Laurence Liss
As a Senior Developer here at Zivtech, part of my job is to develop with an eye towards security. If you follow development and security news, you know that achieving security is pretty hard in complex systems. But, while correctly implementing security across a site is challenging, some aspects...
Sep 11, 2013 | Posted by: Alban Bailly
Drupal Page: https://drupal.org/project/bear_skin GitHub: https://github.com/alioso/bear-skin Live Demo: http://bearst.dev.zivtech.com/   My Name is Alban and I'm a front-end dev here at Zivtech. We use an installation profile called Bear and I have been working on a theme to go along...
Apr 16, 2013 | Posted by: Jody Hamilton
The quality assurance (QA) phase of a web development project is the last phase before launch. While the development team has a lot of experience with QA phases, oftentimes the client team is new to the process, which can lead to stress. Let's prevent this with a little Q&A on QA. What is...
Apr 15, 2013 | Posted by: David Marvin
Nominees for the 17th annual Webby Awards have been announced! And Zivtech-built sites are in the running for four awards! The recently-launched Greatist is nominated for best health website, while DoSomething.org is nominated for best Charitable Organizations/Non-Profit website,...
Feb 14, 2013 | Posted by: Alex Urevick-Ackelsberg
This weekend nine members of the Zivtech staff are participating and competing in Startup Weekend Health Philadelphia 2013, which, according to their site, "centers on building a web or mobile application that could be the basis for a credible business. After 500+ Startup Weekends world-wide...
Feb 11, 2013 | Posted by: Mason Wendell
We love Responsive Web Design, and we love Drupal. But do they love each other? After working on a number of RWD and Drupal projects this year, I'm happy to report that they get along just fine. Though "Love" might be stretching it a bit. Can Drupal and RWD be Pals? Drupal is a great platform...

Pages