When Content Access is enabled, Scheduler lightweight cron is unusable for an anonymous user.
It's a problem because cron job is launched as a Drupal anonymous user and nodes can't be published at time.

It seems that Content Access removes the line which grant access to the node in node_access table, when the node is saved with a scheduling time.

See in SchedulerManager::publish()

      $query = \Drupal::entityQuery('node')
        ->exists('publish_on')
        ->condition('publish_on', REQUEST_TIME, '<=')
        ->condition('type', $scheduler_enabled_types, 'IN')
        ->sort('publish_on')
        ->sort('nid');
      $nids = $query->execute();

This query part seems to be added by Content Access when Scheduler selects nodes to be published :

... AND ( EXISTS  (
    SELECT na.nid AS nid
    FROM node_access na
    WHERE (
      ((gid IN  (0)) AND (realm = 'all') )
      OR( (gid IN  (0)) AND (realm = 'content_access_author') )
      OR( (gid IN  (1)) AND (realm = 'content_access_roles') )
    )
    AND (na.grant_view >= 1) 
    AND (base_table.nid = na.nid) ...
  )

This query solves the problem for one time and one node ([nid]) :

INSERT INTO `node_access` (`nid`, `langcode`, `fallback`, `gid`, `realm`, `grant_view`, `grant_update`, `grant_delete`) VALUES ('[nid]', 'fr', '1', '0', 'all', '1', '0', '0');
[nid] is for the example.

I'm not sure that the problem is only due to Content Access, so this is a duplicated issue from Content Access issue page (https://www.drupal.org/node/2865787).

Thanks.

Enzo

Comments

EnzoFr created an issue. See original summary.

jonathan1055’s picture

Status: Active » Closed (duplicate)

Hello EnzoFr,

I was about to write a reply here, but I think instead of having two issues, I will close this one, so that all activity and responses can be written in the Content Access issue #2865787: Conflict between Scheduled publishing and Content Access sql query modifications. This will avoid duplication and confusion. The project can be changed later to Scheduler if it turns out that the fix can be made in Scheduler alone.

Jonathan