"Enable CF Merge branch 'OpenSAP-week3-unit5' of https://github.com/SAP-samples/cloud-cap-samples into OpenSAP-week3-unit5

This commit is contained in:
pianocktail
2020-02-06 08:33:34 +00:00
8 changed files with 215 additions and 0 deletions

View File

@@ -14,7 +14,10 @@ annotate AdminService.Orders with @odata.draft.enabled;
extend service AdminService with {
entity OrderItems as select from my.OrderItems;
}
<<<<<<< HEAD
=======
>>>>>>> cad3a32c78620f4c4558fad34991dd48866af8d3
// Restrict access to orders to users with role "admin"
annotate AdminService.Orders with @(restrict: [
{ grant: 'READ', to: 'admin' }

View File

@@ -1,5 +1,6 @@
/** Service implementation for AdminService */
module.exports = cds.service.impl(function() {
<<<<<<< HEAD
this.before ('CREATE', 'Orders', _checkOrderCreateAuth)
})
@@ -8,3 +9,13 @@ module.exports = cds.service.impl(function() {
function _checkOrderCreateAuth (req) {
req.user.currency[0] === req.data.currency_code || req.reject(403)
}
=======
this.before ('CREATE', 'Orders', _checkOrderCreateAuth)
})
/** Check authorization */
function _checkOrderCreateAuth (req) {
req.user.currency[0] === req.data.currency_code || req.reject(403)
}
>>>>>>> cad3a32c78620f4c4558fad34991dd48866af8d3

View File

@@ -24,3 +24,6 @@ async function _reduceStock (req) {
)
}))
}