From 00493dd6964e2fdc8337705885d3140b082a0e27 Mon Sep 17 00:00:00 2001
From: James Harvey <james@webmarkdesigns.com.au>
Date: Wed, 11 Dec 2013 15:21:48 +1100
Subject: [PATCH] Issue #2154245 by jamesharv: Cron runs as anonymous user so
 node access prevents sync on unpublished nodes.

---
 ooyala.module | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/ooyala.module b/ooyala.module
index b4b41d5..b7d04d0 100755
--- a/ooyala.module
+++ b/ooyala.module
@@ -753,6 +753,10 @@ function ooyala_load_nodes($embed_code, $partial = FALSE, $limit = 10) {
       $field_instance = field_info_fields($field_name, $node_type->type);
       // Match any rows of the latest revision that contain this embed_code using EntityFieldQuery.
       $query = new EntityFieldQuery();
+      // Disables access checks so that cron runs can sync unpublished
+      // nodes. This is necessary because cron is always run as the anonymous
+      // user.
+      $query->addTag('DANGEROUS_ACCESS_CHECK_OPT_OUT');
       if ($partial) {
         $entities = $query->entityCondition('entity_type', 'node')
                           ->entityCondition('bundle', $node_type->type)
-- 
1.7.12.4 (Apple Git-37)

