From 10b406b0e9ca273e480b901bc77e3d66d5ac4770 Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Wed, 12 Feb 2014 09:12:48 +0100 Subject: [PATCH 1/5] flush the user authentication cache after any modifications --- .../modules/org/arangodb/users-common.js | 27 +++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/js/common/modules/org/arangodb/users-common.js b/js/common/modules/org/arangodb/users-common.js index 2709316440..e31bb63084 100644 --- a/js/common/modules/org/arangodb/users-common.js +++ b/js/common/modules/org/arangodb/users-common.js @@ -192,7 +192,10 @@ exports.save = function (username, passwd, active, extra) { data.extra = extra; } - return users.save(data); + var doc = users.save(data); + // not exports.reload() as this is an abstract method... + require("org/arangodb/users").reload(); + return doc; } var err = new ArangoError(); @@ -270,8 +273,12 @@ exports.replace = function (username, passwd, active, extra) { if (extra !== undefined) { data.extra = extra; } - - return users.replace(user, data); + + var doc = users.replace(user, data); + + // not exports.reload() as this is an abstract method... + require("org/arangodb/users").reload(); + return doc; }; //////////////////////////////////////////////////////////////////////////////// @@ -339,8 +346,13 @@ exports.update = function (username, passwd, active, extra) { if (extra !== undefined) { data.extra = extra; } + + var doc = users.update(user, data); + + // not exports.reload() as this is an abstract method... + require("org/arangodb/users").reload(); - return users.update(user, data); + return doc; }; //////////////////////////////////////////////////////////////////////////////// @@ -384,7 +396,12 @@ exports.remove = function (username) { throw err; } - return users.remove(user._id); + var doc = users.remove(user._id); + + // not exports.reload() as this is an abstract method... + require("org/arangodb/users").reload(); + + return doc; }; //////////////////////////////////////////////////////////////////////////////// From 28edb544fda4c61b36278ebd33481963e7518b8c Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Wed, 12 Feb 2014 09:15:47 +0100 Subject: [PATCH 2/5] fixed jslint warnings --- js/server/modules/org/arangodb.js | 2 +- js/server/modules/org/arangodb/arango-collection.js | 2 +- js/server/modules/org/arangodb/arango-database.js | 2 +- js/server/modules/org/arangodb/arango-statement.js | 2 +- js/server/modules/org/arangodb/shaped-json.js | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/js/server/modules/org/arangodb.js b/js/server/modules/org/arangodb.js index 68aef5b2e7..b6429c4e8f 100644 --- a/js/server/modules/org/arangodb.js +++ b/js/server/modules/org/arangodb.js @@ -1,5 +1,5 @@ /*jslint indent: 2, nomen: true, maxlen: 100, sloppy: true, vars: true, white: true, plusplus: true */ -/*global require, exports */ +/*global require, exports, module */ //////////////////////////////////////////////////////////////////////////////// /// @brief JavaScript base module diff --git a/js/server/modules/org/arangodb/arango-collection.js b/js/server/modules/org/arangodb/arango-collection.js index 4b28975f50..e5cec2e443 100644 --- a/js/server/modules/org/arangodb/arango-collection.js +++ b/js/server/modules/org/arangodb/arango-collection.js @@ -1,5 +1,5 @@ /*jslint indent: 2, nomen: true, maxlen: 100, sloppy: true, vars: true, white: true, plusplus: true */ -/*global require, exports */ +/*global require, exports, module */ //////////////////////////////////////////////////////////////////////////////// /// @brief ArangoCollection diff --git a/js/server/modules/org/arangodb/arango-database.js b/js/server/modules/org/arangodb/arango-database.js index 4a66fd814f..90be43940c 100644 --- a/js/server/modules/org/arangodb/arango-database.js +++ b/js/server/modules/org/arangodb/arango-database.js @@ -1,5 +1,5 @@ /*jslint indent: 2, nomen: true, maxlen: 100, sloppy: true, vars: true, white: true, plusplus: true */ -/*global require, exports, TRANSACTION */ +/*global require, exports, module, TRANSACTION */ //////////////////////////////////////////////////////////////////////////////// /// @brief ArangoDatabase diff --git a/js/server/modules/org/arangodb/arango-statement.js b/js/server/modules/org/arangodb/arango-statement.js index c0d926238f..b0a6009d32 100644 --- a/js/server/modules/org/arangodb/arango-statement.js +++ b/js/server/modules/org/arangodb/arango-statement.js @@ -1,5 +1,5 @@ /*jslint indent: 2, nomen: true, maxlen: 100, sloppy: true, vars: true, white: true, plusplus: true */ -/*global require, exports */ +/*global require, exports, module */ //////////////////////////////////////////////////////////////////////////////// /// @brief ArangoStatement diff --git a/js/server/modules/org/arangodb/shaped-json.js b/js/server/modules/org/arangodb/shaped-json.js index d9718fa3c0..c6ae32d222 100644 --- a/js/server/modules/org/arangodb/shaped-json.js +++ b/js/server/modules/org/arangodb/shaped-json.js @@ -1,5 +1,5 @@ /*jslint indent: 2, nomen: true, maxlen: 100, sloppy: true, vars: true, white: true, plusplus: true */ -/*global require, exports */ +/*global require, exports, module */ //////////////////////////////////////////////////////////////////////////////// /// @brief ShapedJson From ee822fb182ea45641d9452bf38d271cdfa1feb3f Mon Sep 17 00:00:00 2001 From: scottashton Date: Wed, 12 Feb 2014 09:27:39 +0100 Subject: [PATCH 3/5] cleanup code, added linebreaks --- js/actions/api-graph.js | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/js/actions/api-graph.js b/js/actions/api-graph.js index c01b92bdae..01d11102b9 100644 --- a/js/actions/api-graph.js +++ b/js/actions/api-graph.js @@ -255,7 +255,9 @@ function post_graph_graph (req, res) { var edges = json.edges; var waitForSync = false; - if (req.parameters.waitForSync && (req.parameters.waitForSync === "true" || req.parameters.waitForSync === true)) { + if (req.parameters.waitForSync && + (req.parameters.waitForSync === "true" || + req.parameters.waitForSync === true)) { waitForSync = true; } var g = new graph.Graph(name, vertices, edges, waitForSync); @@ -480,7 +482,9 @@ function delete_graph_graph (req, res) { } var waitForSync = g._gdb.properties().waitForSync; - if (req.parameters.waitForSync && (req.parameters.waitForSync === "true" || req.parameters.waitForSync === true)) { + if (req.parameters.waitForSync && + (req.parameters.waitForSync === "true" || + req.parameters.waitForSync === true)) { waitForSync = true; } @@ -568,7 +572,9 @@ function post_graph_vertex (req, res, g) { } var waitForSync = g._vertices.properties().waitForSync; - if (req.parameters.waitForSync && (req.parameters.waitForSync === "true" || req.parameters.waitForSync === true)) { + if (req.parameters.waitForSync && + (req.parameters.waitForSync === "true" || + req.parameters.waitForSync === true)) { waitForSync = true; } @@ -766,7 +772,9 @@ function delete_graph_vertex (req, res, g) { } var waitForSync = g._vertices.properties().waitForSync; - if (req.parameters.waitForSync && (req.parameters.waitForSync === "true" || req.parameters.waitForSync === true)) { + if (req.parameters.waitForSync && + (req.parameters.waitForSync === "true" || + req.parameters.waitForSync === true)) { waitForSync = true; } @@ -808,7 +816,9 @@ function update_graph_vertex (req, res, g, isPatch) { } var waitForSync = g._vertices.properties().waitForSync; - if (req.parameters.waitForSync && (req.parameters.waitForSync === "true" || req.parameters.waitForSync === true)) { + if (req.parameters.waitForSync && + (req.parameters.waitForSync === "true" || + req.parameters.waitForSync === true)) { waitForSync = true; } @@ -1451,7 +1461,9 @@ function post_graph_edge (req, res, g) { } var waitForSync = g._edges.properties().waitForSync; - if (req.parameters.waitForSync && (req.parameters.waitForSync === "true" || req.parameters.waitForSync === true)) { + if (req.parameters.waitForSync && + (req.parameters.waitForSync === "true" || + req.parameters.waitForSync === true)) { waitForSync = true; } @@ -1655,7 +1667,9 @@ function delete_graph_edge (req, res, g) { } var waitForSync = g._edges.properties().waitForSync; - if (req.parameters.waitForSync && (req.parameters.waitForSync === "true" || req.parameters.waitForSync === true)) { + if (req.parameters.waitForSync && + (req.parameters.waitForSync === "true" || + req.parameters.waitForSync === true)) { waitForSync = true; } @@ -1697,7 +1711,9 @@ function update_graph_edge (req, res, g, isPatch) { } var waitForSync = g._edges.properties().waitForSync; - if (req.parameters.waitForSync && (req.parameters.waitForSync === "true" || req.parameters.waitForSync === true)) { + if (req.parameters.waitForSync && + (req.parameters.waitForSync === "true" || + req.parameters.waitForSync === true)) { waitForSync = true; } From d26839ef446c27dab69946bb8ab8a22d0a17bffa Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Wed, 12 Feb 2014 09:37:37 +0100 Subject: [PATCH 4/5] hint for database names in batches --- Documentation/ImplementorManual/HttpBatch.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Documentation/ImplementorManual/HttpBatch.md b/Documentation/ImplementorManual/HttpBatch.md index f824cce2bd..c710fd2e3d 100644 --- a/Documentation/ImplementorManual/HttpBatch.md +++ b/Documentation/ImplementorManual/HttpBatch.md @@ -40,7 +40,7 @@ its response if it is specified. Otherwise, the server will not send a Content-Id "header" back. The server will not validate the uniqueness of the Content-Id. After the mandatory `Content-Type` and the optional `Content-Id` header, two Windows linebreaks -(i.e. `\\r\\n\\r\\n`) must follow. Any deviation of this structure +(i.e. `\r\n\r\n`) must follow. Any deviation of this structure might lead to the part being rejected or incorrectly interpreted. The part request payload, formatted as a regular HTTP request, must follow the two Windows linebreaks literal directly. @@ -51,7 +51,7 @@ technically is the header of the MIME part, and the HTTP request An actual part request should start with the HTTP method, the called URL, and the HTTP protocol version as usual, followed by arbitrary -HTTP headers. Its body should follow after the usual `\\r\\n\\r\\n` +HTTP headers. Its body should follow after the usual `\r\n\r\n` literal. Part requests are therefore regular HTTP requests, only embedded inside a multipart message. @@ -96,4 +96,10 @@ header of the overall response is `1`: @verbinclude api-batch-fail-response +Please note that the database used for all part operations of a batch +request is determined by scanning the original URL (the URL that contains +`/_api/batch`). It is not possible to override the database name in +part operations of a batch. When doing so, any other database name used +in a batch part will be ignored. + @BNAVIGATE_HttpBatch From 859dd2a9d884cfaa99124c7807421d20d9ea65df Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Wed, 12 Feb 2014 09:59:23 +0100 Subject: [PATCH 5/5] better handling of --javascript.package-path --- CHANGELOG | 3 +++ Documentation/RefManual/JSModuleModules.md | 3 --- arangosh/V8Client/arangosh.cpp | 7 +++++++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index e7c9738d7d..58b882f330 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -3,6 +3,9 @@ v1.5.0 (XXXX-XX-XX) * made module loader more node compatible +* the startup option `--javascript.package-path` for arangosh is now deprecated and does + nothing. Using it will not cause an error, but the option is ignored. + * added coffee script support * Several UI improvements. diff --git a/Documentation/RefManual/JSModuleModules.md b/Documentation/RefManual/JSModuleModules.md index a9209ae4e8..9384d7fa15 100644 --- a/Documentation/RefManual/JSModuleModules.md +++ b/Documentation/RefManual/JSModuleModules.md @@ -93,9 +93,6 @@ The following node packages are preinstalled. you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects. -You can use the command-line option @CO{startup.package-path} to specify the -location of the node packages. - require{#JSModulesRequire} -------------------------- diff --git a/arangosh/V8Client/arangosh.cpp b/arangosh/V8Client/arangosh.cpp index dea2601c84..268dbc1116 100644 --- a/arangosh/V8Client/arangosh.cpp +++ b/arangosh/V8Client/arangosh.cpp @@ -77,6 +77,12 @@ using namespace triagens::arango; //////////////////////////////////////////////////////////////////////////////// static std::string DeprecatedPath; + +//////////////////////////////////////////////////////////////////////////////// +/// @brief we'll store deprecated config option values in here +//////////////////////////////////////////////////////////////////////////////// + +static string DeprecatedPackages; //////////////////////////////////////////////////////////////////////////////// /// @brief command prompt @@ -434,6 +440,7 @@ static vector ParseProgramOptions (int argc, char* argv[]) { ("jslint", &JsLint, "do not start as shell, run jslint instead") // deprecated options ("javascript.modules-path", &DeprecatedPath, "one or more directories separated by semi-colons (deprecated)") + ("javascript.package-path", &DeprecatedPackages, "one or more directories separated by semi-colons (deprecated)") ; #ifdef _WIN32