Python Field level security example

From DreamFactory
Jump to: navigation, search
DreamFactoryTutorialsPython Field level security example
(Created page with "Always removes the 'twitter' and 'skype' fields before returning JSON content to the client. For this change to take effect, you have to enable modification of response in t...")
 
(No difference)

Latest revision as of 18:22, 7 November 2016

Always removes the 'twitter' and 'skype' fields before returning JSON content to the client.

For this change to take effect, you have to enable modification of response in the Admin Console script editor. Check the box 'Allow script to modify request (pre-process) or response (post-process)'.

#db._table.contact.get.post_process
#GET /api/v2/db/_table/contact
 
content = event.response.content;
 
 
if(content.resource):
    for record in content.resource:
       del record['skype'];
if(content.resource):
     for record in content.resource:
       del record['twitter'];