From 8392e66e21b975988c771fb93faecf791438bb20 Mon Sep 17 00:00:00 2001
From: Chris Johnson <cjohnson@dosomething.org>
Date: Tue, 25 Sep 2012 17:45:06 -0400
Subject: [PATCH] Issue #1794942 by chris.johnson Resolve discrepancy between
 webform_submission_access() and
 webform_entity_submission_access() ops.

---
 webform_entity.module |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/webform_entity.module b/webform_entity.module
index 9de4324..e74a3e2 100644
--- a/webform_entity.module
+++ b/webform_entity.module
@@ -1027,7 +1027,20 @@ function webform_entity_save_webform_submission($submission) {
  */
 function webform_entity_submission_access($op, $entity = NULL, $account = NULL, $entity_type = NULL) {
   if (isset($entity)) {
-    return webform_submission_access(node_load($entity->nid), $entity, $op, $account);
+    $node = node_load($entity->nid);
+
+    if ($op == 'update') {
+      $op = 'edit';
+    }
+    else if ($op == 'create') {
+      // TODO: See if there's a better way to do this. Since this was failing before with
+      // no implications, this should be safe until the issue below is solved in Webform.
+      //
+      // http://drupal.org/node/1794960
+      return FALSE;
+    }
+
+    return webform_submission_access($node, $entity, $op, $account);
   }
 }
 
-- 
1.7.4.4

