Python field level security

From DreamFactory
Jump to: navigation, search
DreamFactoryTutorialsPython field level security

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'];