From commits-return-2367-apmail-couchdb-commits-archive=couchdb.apache.org@couchdb.apache.org Tue Apr 21 00:22:59 2009 Return-Path: Delivered-To: apmail-couchdb-commits-archive@www.apache.org Received: (qmail 90825 invoked from network); 21 Apr 2009 00:22:59 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 21 Apr 2009 00:22:59 -0000 Received: (qmail 43705 invoked by uid 500); 21 Apr 2009 00:22:59 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 43623 invoked by uid 500); 21 Apr 2009 00:22:59 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 43614 invoked by uid 500); 21 Apr 2009 00:22:59 -0000 Delivered-To: apmail-incubator-couchdb-commits@incubator.apache.org Received: (qmail 43611 invoked by uid 99); 21 Apr 2009 00:22:59 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 21 Apr 2009 00:22:59 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.130] (HELO eos.apache.org) (140.211.11.130) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 21 Apr 2009 00:22:58 +0000 Received: from eos.apache.org (localhost [127.0.0.1]) by eos.apache.org (Postfix) with ESMTP id 16AAC118BB for ; Tue, 21 Apr 2009 00:22:38 +0000 (GMT) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Apache Wiki To: couchdb-commits@incubator.apache.org Date: Tue, 21 Apr 2009 00:22:37 -0000 Message-ID: <20090421002237.1885.51811@eos.apache.org> Subject: [Couchdb Wiki] Update of "Security Features Overview" by SamuelWan X-Virus-Checked: Checked by ClamAV on apache.org Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by SamuelWan: http://wiki.apache.org/couchdb/Security_Features_Overview ------------------------------------------------------------------------------ CouchDB does not support other roles at this time. Support for read access restriction is planned for the 1.0 release. === Validation === - A design document may define a member function called "validate_doc_update". Any request to create or update a document must first pass through each "validate_doc_update" function defined in each design document. The validation functions are executed in an unspecified order. A design document can contain only one validation function. + A design document may define a member function called "validate_doc_update". Requests to create or update a document are validated against every "validate_doc_update" function defined in the database. The validation functions are executed in an unspecified order. A design document can contain only one validation function. Errors are thrown as javascript objects. Example of a design document that validates the presence of an "address" field and returns : @@ -47, +47 @@ {"error":"missing_field","reason":"Document must have an address."} }}} + + The "validate_doc_update" function accepts three arguments: + 1. newDoc - The document to be created or used for update. + 1. oldDoc - The current document if document id was specified in the HTTP request + 1. userCtx - User context object, which contains three properties: + a. db - String name of database + a. name - String user name + a. roles - Array of roles to which user belongs. Currently only admin role is supported. +