PoC for code sandboxing
This commit is contained in:
10
ext/srv/AdminService.js
Normal file
10
ext/srv/AdminService.js
Normal file
@@ -0,0 +1,10 @@
|
||||
module.exports = cds.service.impl(function(){
|
||||
|
||||
this.before(['CREATE','UPDATE'],'Books', req => { //> ....
|
||||
const book = req.data
|
||||
if (book.stock < 10 && book.discount > 0.5) {
|
||||
req.error('Hey, da sind so wenig übrig, die wollen wir nicht zu billig verticken')
|
||||
}
|
||||
})
|
||||
|
||||
})
|
||||
9
ext/srv/CatalogService.js
Normal file
9
ext/srv/CatalogService.js
Normal file
@@ -0,0 +1,9 @@
|
||||
console.log ('Böses Zeug', global, process, cds)
|
||||
// process.exit()
|
||||
// const fs = require('fs')
|
||||
// cds.run('Böses Zeugs')
|
||||
// SELECT.from ('Foo')
|
||||
|
||||
module.exports = cds.service.impl(function(){
|
||||
this.after('READ','Books', each => each.title += ' (served through sandbox)')
|
||||
})
|
||||
Reference in New Issue
Block a user