<% /* * Copyright: * (C) 2006 by Derrell Lipman * All rights reserved * * License: * LGPL 2.1: http://creativecommons.org/licenses/LGPL/2.1/ */ /* * JSON-RPC mappings to the ldb ejs functions */ /* We'll be saving resources in the session */ jsonrpc_include("resources.esp"); /** * Local function to determine if the requested database is one which we allow * access to. * * @param dbRequested * Name of the database which is being requested to be opened * * @return * true if access is allowed; false otherwise. */ function accessAllowed(dbRequested) { /* Databases allowed to connect to */ dbAllowed = new Array(); dbAllowed[dbAllowed.length] = "sam.ldb"; for (var i = 0; i < dbAllowed.length; i++) { if (dbRequested == dbAllowed[i]) { return true; } } return false; } /** * Connect to a database * * @param params[0] * Database name * * @param params[1..n] * Option (e.g. "modules:modlist") * * @param error * An object of class JsonRpcError. * * @return * Success: The resource id to be used for future access to the database * Failure: error event * * @note * Credentials or session_info may be set up first. */ function _connect(params, error) { if (params.length < 1) { error.setError(jsonrpc.Constant.ErrorCode.ParameterMismatch, "usage: [