UNPKG

@zargu/couchdb-designer

Version:

Create and testing couchdb design document form directory structure.

14 lines (13 loc) 472 B
function validate_doc_update(newDoc, oldDoc, userCtx, secObj) { if (newDoc._deleted === true) { // allow deletes by admins and matching users // without checking the other fields if ((userCtx.roles.indexOf('_admin') !== -1) || (userCtx.name == oldDoc.name)) { return; } else { throw({forbidden: 'Only admins may delete other user docs.'}); } } } module.exports = { validate_doc_update };