How to grant view access by node

Hi,
I want to have the HOME page of my drupal 8 website public and all the rest you need to be authenticated.
I manage to have all the pages accessible when you are authenticated but I do not know how to make the home page visible publicly and to avoid to have “access denied”.

Thanks for your tips …
Regards.
Joel.

Jello Joel,

Does the home page have the same content type as the rest of the pages? Do you want to restrict access in content type or node level?

Konstantinos

I was thinking to restrict at the node level, if possible because the content type is BASIC PAGE and used elsewhere.

Hello Joel,

In general you can find different modules to grant permissions and access. However only a few of them can modify the node level and most of them are not stable, which can create long term issues.

The one I found that is stable is the Permissions By Term module and is stable, hence safe. What it does is that it grants access based on the Term that is tagged with.

The steps I suggest to follow are:

  1. Install and enable the module
  2. Create a vocabulary to tag nodes and differentiate their access. For example you can name it “Access”.
  3. Also create at least 2 terms: Public (they are accessible for everyone) and Registered (accessible only for registered users). When you create the term, you can choose who has to view in the permissions options.
  4. Create a field in the content type that you want to limit accessibility. It should be of type Reference to taxonomy term. Make sure to make the field required and also to set the Registered term as default. The last one is very important because if you dont set default then more nodes will be accessible
  5. Visit the node you want to make public and tag it as public.
  6. Dont forget to test it to visit both the node and the edit form both from registered and non registered users.

Let me know if you have more questions.