summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Christopher Anderson <jchris@apache.org>2010-07-13 14:25:03 +0000
committerJohn Christopher Anderson <jchris@apache.org>2010-07-13 14:25:03 +0000
commit934693735ad6c6358a240a466d4ce121f150e1aa (patch)
treedee4dfd01224c0df892c1ca1b200bb8a12c8bb14 /src
parent9599f7cd77ef8a6feacec3c8ead9432af02a57d3 (diff)
test and fix for deleting users documents
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@963723 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/couchdb/couch_js_functions.hrl8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/couchdb/couch_js_functions.hrl b/src/couchdb/couch_js_functions.hrl
index 3214b1f6..1f314f6e 100644
--- a/src/couchdb/couch_js_functions.hrl
+++ b/src/couchdb/couch_js_functions.hrl
@@ -12,10 +12,6 @@
-define(AUTH_DB_DOC_VALIDATE_FUNCTION, <<"
function(newDoc, oldDoc, userCtx) {
- if ((oldDoc && oldDoc.type !== 'user') || newDoc.type !== 'user') {
- throw({forbidden : 'doc.type must be user'});
- } // we only allow user docs for now
-
if (newDoc._deleted === true) {
// allow deletes by admins and matching users
// without checking the other fields
@@ -27,6 +23,10 @@
}
}
+ if ((oldDoc && oldDoc.type !== 'user') || newDoc.type !== 'user') {
+ throw({forbidden : 'doc.type must be user'});
+ } // we only allow user docs for now
+
if (!newDoc.name) {
throw({forbidden: 'doc.name is required'});
}