From 5d61945ca7b8f6dfaec0cc8286ca954089b9a4be Mon Sep 17 00:00:00 2001
From: Brandon Williams <rocketeerbkw@gmail.com>
Date: Mon, 2 Apr 2012 18:10:25 -0500
Subject: [PATCH] Issue #1512902: Document hook_webform_results_access().

---
 webform.api.php |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/webform.api.php b/webform.api.php
index 21c9b3d..6f11b0a 100644
--- a/webform.api.php
+++ b/webform.api.php
@@ -432,6 +432,27 @@ function hook_webform_component_info_alter(&$components) {
 }
 
 /**
+ * Determine if a user has access to see the results of a webform.
+ *
+ * The $account must have view access to the webform as well as
+ * view access to the results in order to see them.
+ * @see webform_results_access()
+ *
+ * @param $node
+ *   The Webform node to check access on.
+ * @param $account
+ *   The User account to check access on.
+ * @return
+ *   True or False if the user can access the webform results.
+ */
+function hook_webform_results_access($node, $account) {
+  // Let editors view results of unpublished webforms
+  if ($node->status = 0 && in_array('editor', $account->roles)) {
+    return true;
+  }
+}
+
+/**
  * Return an array of files associated with the component.
  *
  * The output of this function will be used to attach files to e-mail messages.
-- 
1.7.9

