Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I have a content type of "Blog". The default via Nodeaccess is to allow access to all nodes of the "Blog" content type. However there are some nodes that I want to only allow certain roles.
I've enabled content node access control settings. So I should be able to uncheck the roles I do not want to have access to a specific node.
The blog nodes are displayed via a View. And the view's Access Control is "unrestricted".
Regardless of which roles are allowed via the node's access control, all roles can access the nodes via the view. Am I doing something wrong here?
Comments
Comment #1
Anonymous (not verified) CreditAttribution: Anonymous commentedIt is hard to say without seeing what is going on. Could you upload a dump of your database?
If you view the nodes individually when you shouldn't be able to see them, do you get access denied or are you able to view them? In other words is it only broken in views, or completely?
Comment #2
ahaque89 CreditAttribution: ahaque89 commentedI have a feeling because in your "Nodeaccess" settings all roles are currently allowed to view "pages" by default.
When you made the view you are probably displaying the view as a page... so it is defaulting to those "page" nodeaccess settings. In the views access control settings it says: "Only the checked roles will be able to access this display. Note that users with "access all views" can see any view, regardless of role."
I might be wrong.... but this is something I'm trying to figure out as well. What's the best way to restrict access to particular views? Since I can't figure out how to do it with nodeaccess just yet.
Comment #3
jduhls CreditAttribution: jduhls commentedPlease add views integration so I can filter by nodeaccess grants. I'm on 7.x. "Content Access" module is not working.
Comment #4
vlad.pavlovic CreditAttribution: vlad.pavlovic commentedI am closing this as duplicate of #899756: Nodes show up in views, even when they're restricted by role as it is ultimately the same issue. Please follow that issue for updates.