UNPKG

@sap/xsodata

Version:

Expose data from a HANA database as OData V2 service with help of .xsodata files.

19 lines (14 loc) 588 B
'use strict'; var Http403_Forbidden = require('../../utils/errors/http/forbidden'); module.exports = function checkModificationForbidden(context, callback){ var methodModificationMap = { 'put': 'update', 'post' : 'create', 'delete' : 'delete' }; var modification = methodModificationMap[context.request.method.toLowerCase()]; if (context.oData.dbSegmentLast.entityType.modifications[modification] === 'forbidden'){ return callback(new Http403_Forbidden('Modification forbidden.'), context); } return callback(null, context); };