Files
cloud-cap-samples/packages/bookshop/srv/admin-service.js
Matthias Bühl a458c7bb0d cleanup
2020-01-30 17:48:32 +01:00

10 lines
310 B
JavaScript

/** Service implementation for AdminService */
module.exports = cds.service.impl(function() {
this.before ('CREATE', 'Orders', _checkOrderCreateAuth)
})
/** Check authorization */
function _checkOrderCreateAuth (req) {
req.user.currency[0] === req.data.currency_code || req.reject(403)
}