diff options
author | John Christopher Anderson <jchris@apache.org> | 2010-07-02 18:39:15 +0000 |
---|---|---|
committer | John Christopher Anderson <jchris@apache.org> | 2010-07-02 18:39:15 +0000 |
commit | c09569f8ea99cd8a7e2fbf580d7da847d345cda7 (patch) | |
tree | fe6ac28fa8b22fa91f474a7402f0a141ac7f7fed /src/couchdb/couch_js_functions.hrl | |
parent | 494c6b6883b2fdc5539df3a4b7d11fba4a136668 (diff) |
fix edge case in users db validation fun
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@960084 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb/couch_js_functions.hrl')
-rw-r--r-- | src/couchdb/couch_js_functions.hrl | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/couchdb/couch_js_functions.hrl b/src/couchdb/couch_js_functions.hrl index ca1a5863..3214b1f6 100644 --- a/src/couchdb/couch_js_functions.hrl +++ b/src/couchdb/couch_js_functions.hrl @@ -12,9 +12,9 @@ -define(AUTH_DB_DOC_VALIDATE_FUNCTION, <<" function(newDoc, oldDoc, userCtx) { - if ((oldDoc || newDoc).type !== 'user') { + if ((oldDoc && oldDoc.type !== 'user') || newDoc.type !== 'user') { throw({forbidden : 'doc.type must be user'}); - } // we only validate user docs for now + } // we only allow user docs for now if (newDoc._deleted === true) { // allow deletes by admins and matching users |