couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Couchdb Wiki] Update of "Security_Features_Overview" by jchrisa
Date Tue, 02 Feb 2010 17:39:14 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification.

The "Security_Features_Overview" page has been changed by jchrisa.
The comment on this change is: fixed validation example.
http://wiki.apache.org/couchdb/Security_Features_Overview?action=diff&rev1=6&rev2=7

--------------------------------------------------

     _id: "_design/myview",
     validate_doc_update: "function(newDoc, oldDoc, userCtx) {
        if(newDoc.address === undefined) {
-          throw {missing_field: 'Document must have an address.'};
+          throw {forbidden: 'Document must have an address.'};
        }"
  }
  }}}
  
  The result of a document update without the address field will look like this:
  {{{
- HTTP/1.1 401 Unauthorized
+ HTTP/1.1 403 Forbidden
  WWW-Authenticate: Basic realm="administrator"
  Server: CouchDB/0.9.0 (Erlang OTP/R12B)
  Date: Tue, 21 Apr 2009 00:02:32 GMT
@@ -44, +44 @@

  Content-Length: 57
  Cache-Control: must-revalidate
  
- {"error":"missing_field","reason":"Document must have an address."} 
+ {"error":"forbbiden","reason":"Document must have an address."} 
  }}}
  
  

Mime
View raw message