summaryrefslogtreecommitdiff
path: root/share/server/main.js
diff options
context:
space:
mode:
authorDamien F. Katz <damien@apache.org>2008-11-11 19:45:50 +0000
committerDamien F. Katz <damien@apache.org>2008-11-11 19:45:50 +0000
commit9044fc0234ed65056f087a86c7c117922f2a2c75 (patch)
treeea87133de1e3617c5d3d7366983b7f7039d6cffd /share/server/main.js
parent538f455f2e2842d5caa33ed300d28b3cd52599b3 (diff)
Check in of initial validation and authorization work. This work is incomplete, as there is not yet any way of restricting who can update the design docs.
git-svn-id: https://svn.apache.org/repos/asf/incubator/couchdb/trunk@713132 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share/server/main.js')
-rw-r--r--share/server/main.js14
1 files changed, 13 insertions, 1 deletions
diff --git a/share/server/main.js b/share/server/main.js
index df184c1c..bdb03c60 100644
--- a/share/server/main.js
+++ b/share/server/main.js
@@ -153,7 +153,19 @@ while (cmd = eval(readline())) {
print("[true," + toJSON(reductions) + "]");
}
break;
-
+ case "validate":
+ var funSrc = cmd[1];
+ var newDoc = cmd[2];
+ var oldDoc = cmd[3];
+ var userCtx = cmd[4];
+ var validateFun = compileFunction(funSrc);
+ try {
+ validateFun(newDoc, oldDoc, userCtx);
+ print("1");
+ } catch (error) {
+ print(toJSON(error));
+ }
+ break;
default:
print(toJSON({error: "query_server_error",
reason: "unknown command '" + cmd[0] + "'"}));