You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by jc...@apache.org on 2010/02/03 18:29:46 UTC
svn commit: r906140 - in /couchdb/trunk:
share/www/script/test/security_validation.js src/couchdb/couch_db.erl
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, {[]}),