Is there a standard Drupal way (without coding) to set up a site where all content is inaccessible to anonymous users except for one node which is used as the logged-out home page?

I've found ways to dictate what should be shown on the logged-out front page (e.g. using Front page module or Page Manager + Panels) but I haven't found a way to give Anonymous users access to a single node while keeping all the rest hidden from them.


Tobias Xy’s picture

You could either create a content type for nodes visible to anonymous users and hide all nodes from anonymous users, which aren't of this specific type.

Or you could install a module, that provides node level access, like: (I never used this one, but it seems to be sufficient for your purposes).

crantok’s picture

I tried both content_access and nodeaccess modules but, when Anon users do not have the "View published content" permission, it doesn't seem to be possible to grant them access to any content through either of those modules.

With the content_access module, you could give Anon users "View published content" and then turn off access for all but one content type (e.g. a "Home page" content type.) I don't like this solution because, in future, I have to then remember to turn off access to any new content type that I add. This could lead to embarrassing mistakes.

Jaypan’s picture

The front page module also works well for this.

crantok’s picture

As I mentioned in my OP, the Front page module works for setting what content should appear on the home page, but does not help with the permissions aspect.

Jaypan’s picture

You just need to remove 'Access Content' permission for anonymous users. Then they will only be able to access the node you set to be shown on the front page through the front page module.

crantok’s picture

I think you've misunderstood me.

(BTW I'm using Drupal 7 so there is no 'Access content' permission. There is a 'View published content' permission.)

I've removed the 'View published content' permission from anonymous users. They can't see any content. I can't find a module that will then give anonymous users permission to see a given piece of content. Neither nodeaccess nor content_access seem to be able to do this. I get Access denied when my anon users visit the front page node specified by the Front page module.

Jaypan’s picture

That's what you can use the front page module for. It will show content to anonymous users, even when they don't have view published content permissions. You have to give them permission to access the front page module however.

I haven't misunderstood you, I've done it myself, and I even pointed someone in this directly not two weeks ago, and they reported back that it worked for them. Play with the module settings and permissions a bit.

crantok’s picture

The only Front page module permission that I can see is 'Administer front page'.

I've just realised that there is a module called 'Front page' and another called 'Frontpage'. Please can you confirm which you are using and which Drupal core version?

Jaypan’s picture

I linked to the module I was referring to. Please follow the link.

crantok’s picture

Ah. I see you did. I beg your pardon. That answers one of my questions.

loloyd’s picture

This is not a "+1 (plus 1) post but I would like to drive your point home as well. I've been a long time user of Drupal and I have to agree that the current alternative solutions for OUR current situation leaves a lot to be desired. I've been using Drupal for "internal use" or "club-type" websites and it is quite frustrating to use content-type access modules for just a simple problem - just because there isn't a fine-grained permission set for "View published content". And yet we're talking about a mature Drupal version here - 7. I always wonder why this very basic feature is not intrinsic to Drupal core.

As of now, on my many D7 applications for "internal use" or "club-type" websites, I still have to use the Content Access module for welcome and announcement nodes to anonymous (or yet-to-be-logged-in) users. I confirm the same pains (we don't have any other "beautiful" alternatives yet) for this same tiny "problem" and we will always have to remind ourselves to explicitly revisit the entire permissions set whenever we make a new content type for our logged on users.

PS. I tend to not use Front Page module as it "appears" to break security protocols and holistically restrictive policies that I would want to enforce on my websites.

WorldFallz’s picture

Though I tend to agree that view access by content type (not node) should be part of core, there are simpler alternatives than content_access (which in most cases is probably overkill). I've used simple_access, private, node_privacy_byrole, and node_view_permissions and they all work well.

Care about the future of the forums? Please join our conversation and show support for improving the forums infrastructure.

crantok’s picture

Thanks for the list of modules! I've just read through their summary pages and am sure that one or more of them will do what I want.

crantok’s picture

I'm kind of reassured that there isn't an "obvious" solution. I have a habit of feeling like a novice all over again when I hit a new (to me) problem in Drupal. Thanks for the input.

charlie charles’s picture

This video show you how to hide
any page from different types of users