"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:
@@ -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' }
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -24,3 +24,6 @@ async function _reduceStock (req) {
|
||||
)
|
||||
}))
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user