Private website with Rules - Inherit custom fields I want to create a website where all the content is only visible to logged in users.

(I don't want to solve it by using other access modules or by configuring the permissions of the roles, for specific other reasons.)

What I basically try to do with Rules is the following:

Given the value of "custom field X" (boolean) of "content type A" is true,
When a user  views a node of "content type B"
Then I want to redirect the user to [site:login-url]


But it seems that there is not a straightforward way to do this. Couple of methods that could be possible are:


Using entity reference: inheriting the value and firing the condition on the node view
Views looping: creating a view and firing the condition on all node views
Checking the value somehow when Drupal is initializing


I could do this also within a template tpl preprocess, by simply adding the logic. But it feels not right to solve it that way. Possibly because then there are other security issues that I'm afraid of neglecting.

Is there a better / easier way to do this? What would you recommend?
This is very straight forward in Rules without the need for extra modules:


Event: Content is viewed of type [content-type]


You can add one event for each content type, or as the description in the Rule itself states: If you need to filter for multiple values, either add multiple events or use the "Entity is of bundle" condition instead.


set a boolean field in the content type to determine if it should be public or not
Condition: Data Comparison: Parameter: Data to compare: [node:field-to-determine-if-viewable], Data value
Action: Page Redirect: Parameter: URL: user/login


This will check every page load of a content type (or all if you so desire) and redirect if the boolean is set (or not set) depending on how you want it set up