From 86275ba4bb2a42a3e17e1af1450a616d53ca16d7 Mon Sep 17 00:00:00 2001
From: Chris Oden <wodenx@gmail.com>
Date: Sun, 4 Aug 2013 09:08:35 -0400
Subject: [PATCH] Issue #1865102: Pass entity bundle information to
 entity_access

---
 plugins/services_entity_resource.inc | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/plugins/services_entity_resource.inc b/plugins/services_entity_resource.inc
index 9c67799..f2539f6 100644
--- a/plugins/services_entity_resource.inc
+++ b/plugins/services_entity_resource.inc
@@ -14,9 +14,11 @@ class ServicesEntityResourceController implements ServicesResourceControllerInte
       return TRUE;
     }
     if ($op == 'create') {
-      list($entity_type) = $args;
-      // Pass the entity to the access control.
-      return entity_access($op, $entity_type);
+      list($entity_type, $data) = $args;
+      // Create an entity from the data and pass this to entity_access. This allows us
+      // to check per-bundle creation rights (e.g. in node_access).
+      $entity = entity_create($entity_type, $data);
+      return entity_access($op, $entity_type, $entity);
     }
     else {
       // Retrieve, Delete, Update.
-- 
1.8.1.3

