From 9044fc0234ed65056f087a86c7c117922f2a2c75 Mon Sep 17 00:00:00 2001 From: "Damien F. Katz" Date: Tue, 11 Nov 2008 19:45:50 +0000 Subject: 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 --- share/server/main.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'share/server') 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] + "'"})); -- cgit v1.2.3