function(new_doc, old_doc, userCtx) { if(userCtx.roles.indexOf("marketing") == -1) { throw({unauthorized: "Sie haben nicht die Rolle 'marketing'."}); } }