Using Rules and Content access to restrict node access after date The Goal

I am working on a way to shut off access to all nodes of a given type by setting their Content Access permissions to off, after a certain date has passed (and presuming that their access levels are not presently set to not allow anyone to see them, as I don't want this to trigger every time the rules run in a date range). Rules + Content Access was suggested to me in the #drupal IRC channel, but I'm not totally sure it is going to work.

What I've done so far


I have added a rule to be triggered when Cron Maintenance tasks run.
I added a "Data Comparison" rule to check site:current-date and see if it is past a certain value.


The Issue

When I go in to add the action of "Revoke Access By Role", I do not have the option to set on which content types I want the access revoked by. In fact, the only option in the selector is site:.

I have also attempted to add a node condition, but there is also no way to select any node fields, presumably because it's wanting to act on whatever triggered the event (i.e. Content Updated in the case of nodes), and since I've selected a cron I only have access to the site: parameters.

My Question

Is there a way to tell rules to change the content permissions for all nodes of a content type via a cron maintenance run, or will I need to write a custom method to be triggered via the rules condition? (Or a completely separate module for that matter).
A proposition:


Enable "Rules Sheduler" at /admin/modules.
Go to /admin/config/workflow/rules/components and create a component

Add new component:

Component plugin => Action set
"Continue"

Component plugin:

Specify the component name (e.g. Revoke node access component)

choose in the table:

Data type => Content
Label => Node:Component or Node or what you want
Machine name => node_component or node or what you want
Usage => Parameter
"Continue"

Add actions:

Select actions to add => Revoke access by role
Data selector: is set as node-component by default; this is the selector name you have specified in the table in the step above
In "Role-based access control settings" check roles you want to revoke access for view/edit/delete content
"Save"


Go to admin/config/workflow/rules and add new rule (Add new rule):

Add new rule:

specify the rule name (e.g. Revoke node access rule)
React on event => After saving new content
Restrict by type => optionally, choose a node type you want to apply this rule to
"Save"

Events:

(optionally) you may also add here "After updating existing content" event if the rule has to triggered on existing nodes

Conditions:

(optionally) add your additional conditions here

Actions:

Add action
Select the action to add => Schedule component evaluation
Component: Select yor component you have already created (Revoke node access component)
Continue
Scheduled evaluation date:
click the "Switch to data selection and specify" button and specify:

Data selector: node:created (or other date-based condition)
Add offset: optionally specfify an offset for the chosen data selector (e.g. 1 seconds)

Identifier: Specify an identifer ("A string used for identifying this task") which is visible (Rules) "Scheduler" (/admin/config/workflow/rules/schedule) and in "Recent log messages" (/admin/reports/dblog). You may use tokens/replacement patterns.
Node:Component:
Data selector => node
Save




What's this?

This solution triggers a rule after a new and/or existing node has been saved. The rule "schedules" the component with an action set - in our case, the action is to revoke node access to the checked user roles. After content has been added as new and or edited, the component revokes node access on nodes for specified roles as scheduled on cron run, e.g. adding new article now +1 sec makes it unaccessible (view/edit/delete) on next cron on > (node:created +1 sec).

Hint:

It is also possible to add Schedule component evaluation as an action into a component. For example: you want this rule to be triggered using node:changed date, so every time you edit a node, the date for the action "Revoke node access" will be moved forward (e.g: node is changed now => the rule triggers in 1 day (offset in component settings); the node will be changed tomorrow, so the rule will be trigerred on tomorrow date +1 day and so on).



You can import and test the component:

{ "rules_revoke_node_access_component" : {
    "LABEL" : "Revoke node access component",
    "PLUGIN" : "action set",
    "OWNER" : "rules",
    "REQUIRES" : [ "content_access_rules" ],
    "USES VARIABLES" : { "node_component" : { "label" : "Node:Component", "type" : "node" } },
    "ACTION SET" : [
      { "content_access_action_revoke_node_permissions" : {
          "node" : [ "node-component" ],
          "permissions" : { "value" : [
              "view:2",
              "view:1",
              "view:3",
              "view_own:2",
              "view_own:1",
              "view_own:3",
              "update:2",
              "update:1",
              "update:3",
              "update_own:2",
              "update_own:1",
              "update_own:3",
              "delete:2",
              "delete:1",
              "delete:3",
              "delete_own:2",
              "delete_own:1",
              "delete_own:3"
            ]
          }
        }
      }
    ]
  }


    }

You can import and test the rule:

{ "rules_revoke_node_access_rule" : {
    "LABEL" : "Revoke node access rule",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules", "rules_scheduler" ],
    "ON" : { "node_insert" : [], "node_update" : [] },
    "DO" : [
      { "schedule" : {
          "component" : "rules_revoke_node_access_component",
          "date" : { "select" : "node:created", "date_offset" : { "value" : 1 } },
          "identifier" : "Revoke node access",
          "param_node_component" : [ "node" ]
        }
      }
    ]
  }
}