Closed (won't fix)
Project:
RESTful Web Services
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
30 May 2012 at 08:27 UTC
Updated:
14 Jun 2012 at 10:14 UTC
Jump to comment: Most recent file
Comments
Comment #2
klausiHm, that would be an API change. Currently we explicitly require that the properties of an entity are known to not allow arbitrary data (a kind of safe guard). This is also some kind of validation so that the sender can be sure that the data matches what Drupal can process.
Why can't you use hook_entity_property_info() or hook_entity_property_info_alter() to register your custom properties?
Comment #3
amitaibuThose are properties sent from Backbone, which are needed only for the JS application to work, but have no meaning on the entity (e.g. I have a "selected" state on a photo indicating if the user clicked on it).
Comment #4
klausiSo if we want to support use cases where it is allowed to pass unknown properties we also need to change the create operation.
What are the implications of this? Is it a security issue if we allow random data properties on our entity objects? We do have a permission for each resource/entity, so we might just acknowledge that users with that permission can do harmful stuff anyway.
Comment #5
amitaibu> we also need to change the create operation
entity_property_values_create_entity() is already doing the same thing, so we actually going to fix update to work as create.
Comment #6
klausiThe create method does some extra checks after entity_property_values_create_entity(), so we would have to remove that.
Comment #7
amitaibuSomething like this?
Comment #8
amitaibuI agree
Comment #10
klausiI talked to fago about this and he also said that we should keep the validation of entity properties. RESTWS provides a well-defined interface building on the entity property API, accepting data that violates the service contract makes it intransparent what is happening.
If you want to do that I would recommend to create a class MyentityRestWSResourceController extends RestWSEntityResourceController where you overwrite the update() method. Use hook_restws_resource_info_alter() to register your custom class and you should be done.
Comment #11
amitaibuok :)