Return-Path: Delivered-To: apmail-couchdb-commits-archive@www.apache.org Received: (qmail 23071 invoked from network); 3 Feb 2010 17:30:09 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 3 Feb 2010 17:30:09 -0000 Received: (qmail 63361 invoked by uid 500); 3 Feb 2010 17:30:09 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 63297 invoked by uid 500); 3 Feb 2010 17:30:09 -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 63288 invoked by uid 99); 3 Feb 2010 17:30:09 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Feb 2010 17:30:09 +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.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Feb 2010 17:30:07 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 61B212388A77; Wed, 3 Feb 2010 17:29:46 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r906140 - in /couchdb/trunk: share/www/script/test/security_validation.js src/couchdb/couch_db.erl Date: Wed, 03 Feb 2010 17:29:46 -0000 To: commits@couchdb.apache.org From: jchris@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100203172946.61B212388A77@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: jchris Date: Wed Feb 3 17:29:46 2010 New Revision: 906140 URL: http://svn.apache.org/viewvc?rev=906140&view=rev Log: error message on bad security object Modified: couchdb/trunk/share/www/script/test/security_validation.js couchdb/trunk/src/couchdb/couch_db.erl Modified: couchdb/trunk/share/www/script/test/security_validation.js URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/script/test/security_validation.js?rev=906140&r1=906139&r2=906140&view=diff ============================================================================== --- couchdb/trunk/share/www/script/test/security_validation.js (original) +++ couchdb/trunk/share/www/script/test/security_validation.js Wed Feb 3 17:29:46 2010 @@ -187,6 +187,12 @@ T(db.setDbProperty("_security", {admin_override : true}).ok); T(db.save(doc).ok); + // try to do something lame + try { + db.setDbProperty("_security", ["foo"]); + T(false && "can't do this"); + } catch(e) {} + // go back to normal T(db.setDbProperty("_security", {admin_override : false}).ok); Modified: couchdb/trunk/src/couchdb/couch_db.erl URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_db.erl?rev=906140&r1=906139&r2=906140&view=diff ============================================================================== --- couchdb/trunk/src/couchdb/couch_db.erl (original) +++ couchdb/trunk/src/couchdb/couch_db.erl Wed Feb 3 17:29:46 2010 @@ -294,7 +294,9 @@ set_security(#db{security=SecProps, update_pid=Pid}=Db, {SecObjProps}) when is_list(SecObjProps) -> check_is_admin(Db), SecProps2 = update_sec_field(sec_obj, SecProps, {SecObjProps}), - gen_server:call(Pid, {set_security, SecProps2}, infinity). + gen_server:call(Pid, {set_security, SecProps2}, infinity); +set_security(_, _) -> + throw(bad_request). update_sec_field(Field, SecProps, Value) -> Admins = proplists:get_value(admins, SecProps, {[]}),