From dfeb942235becb7cd318adeea692745d9174f393 Mon Sep 17 00:00:00 2001 From: Simran Brucherseifer Date: Fri, 3 Jun 2016 15:03:20 +0200 Subject: [PATCH 1/7] Remove whitespace around separator to fix documentation --- lib/Basics/errors.dat | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/Basics/errors.dat b/lib/Basics/errors.dat index deac3027f9..1c4a24cbaf 100755 --- a/lib/Basics/errors.dat +++ b/lib/Basics/errors.dat @@ -184,8 +184,8 @@ ERROR_ARANGO_DOCUMENT_NOT_FOUND_OR_SHARDING_ATTRIBUTES_CHANGED,1475,"document no ERROR_CLUSTER_COULD_NOT_DETERMINE_ID,1476,"could not determine my ID from my local info","Will be raised if a cluster server at startup could not determine its own ID from the local info provided." ERROR_CLUSTER_ONLY_ON_DBSERVER,1477,"this operation is only valid on a DBserver in a cluster","Will be raised if there is an attempt to run a DBserver-only operation on a different type of node." ERROR_CLUSTER_BACKEND_UNAVAILABLE,1478,"A cluster backend which was required for the operation could not be reached","Will be raised if a required db server can't be reached." -ERROR_CLUSTER_UNKNOWN_CALLBACK_ENDPOINT,1479,"An endpoint couldn't be found", "An endpoint couldn't be found" -ERROR_CLUSTER_AGENCY_STRUCTURE_INVALID,1480,"Invalid agency structure", "The structure in the agency is invalid" +ERROR_CLUSTER_UNKNOWN_CALLBACK_ENDPOINT,1479,"An endpoint couldn't be found","An endpoint couldn't be found" +ERROR_CLUSTER_AGENCY_STRUCTURE_INVALID,1480,"Invalid agency structure","The structure in the agency is invalid" ################################################################################ ## ArangoDB query errors @@ -218,13 +218,13 @@ ERROR_QUERY_FAIL_CALLED,1569,"FAIL(%s) called","Will be raised when the function ERROR_QUERY_GEO_INDEX_MISSING,1570,"no suitable geo index found for geo restriction on '%s'","Will be raised when a geo restriction was specified but no suitable geo index is found to resolve it." ERROR_QUERY_FULLTEXT_INDEX_MISSING,1571,"no suitable fulltext index found for fulltext query on '%s'","Will be raised when a fulltext query is performed on a collection without a suitable fulltext index." ERROR_QUERY_INVALID_DATE_VALUE,1572,"invalid date value","Will be raised when a value cannot be converted to a date." -ERROR_QUERY_MULTI_MODIFY,1573,"multi-modify query", "Will be raised when an AQL query contains more than one data-modifying operation." -ERROR_QUERY_INVALID_AGGREGATE_EXPRESSION,1574,"invalid aggregate expression", "Will be raised when an AQL query contains an invalid aggregate expression." -ERROR_QUERY_COMPILE_TIME_OPTIONS,1575,"query options must be readable at query compile time", "Will be raised when an AQL data-modification query contains options that cannot be figured out at query compile time." -ERROR_QUERY_EXCEPTION_OPTIONS,1576,"query options expected", "Will be raised when an AQL data-modification query contains an invalid options specification." -ERROR_QUERY_COLLECTION_USED_IN_EXPRESSION,1577,"collection '%s' used as expression operand", "Will be raised when a collection is used as an operand in an AQL expression." -ERROR_QUERY_DISALLOWED_DYNAMIC_CALL,1578,"disallowed dynamic call to '%s'", "Will be raised when a dynamic function call is made to a function that cannot be called dynamically." -ERROR_QUERY_ACCESS_AFTER_MODIFICATION,1579,"access after data-modification by %s", "Will be raised when collection data are accessed after a data-modification operation." +ERROR_QUERY_MULTI_MODIFY,1573,"multi-modify query","Will be raised when an AQL query contains more than one data-modifying operation." +ERROR_QUERY_INVALID_AGGREGATE_EXPRESSION,1574,"invalid aggregate expression","Will be raised when an AQL query contains an invalid aggregate expression." +ERROR_QUERY_COMPILE_TIME_OPTIONS,1575,"query options must be readable at query compile time","Will be raised when an AQL data-modification query contains options that cannot be figured out at query compile time." +ERROR_QUERY_EXCEPTION_OPTIONS,1576,"query options expected","Will be raised when an AQL data-modification query contains an invalid options specification." +ERROR_QUERY_COLLECTION_USED_IN_EXPRESSION,1577,"collection '%s' used as expression operand","Will be raised when a collection is used as an operand in an AQL expression." +ERROR_QUERY_DISALLOWED_DYNAMIC_CALL,1578,"disallowed dynamic call to '%s'","Will be raised when a dynamic function call is made to a function that cannot be called dynamically." +ERROR_QUERY_ACCESS_AFTER_MODIFICATION,1579,"access after data-modification by %s","Will be raised when collection data are accessed after a data-modification operation." ################################################################################ ## AQL user functions @@ -239,9 +239,9 @@ ERROR_QUERY_FUNCTION_RUNTIME_ERROR,1583,"user function runtime error: %s","Will ## AQL query registry ################################################################################ -ERROR_QUERY_BAD_JSON_PLAN,1590,"bad execution plan JSON", "Will be raised when an HTTP API for a query got an invalid JSON object." -ERROR_QUERY_NOT_FOUND,1591,"query ID not found", "Will be raised when an Id of a query is not found by the HTTP API." -ERROR_QUERY_IN_USE,1592,"query with this ID is in use", "Will be raised when an Id of a query is found by the HTTP API but the query is in use." +ERROR_QUERY_BAD_JSON_PLAN,1590,"bad execution plan JSON","Will be raised when an HTTP API for a query got an invalid JSON object." +ERROR_QUERY_NOT_FOUND,1591,"query ID not found","Will be raised when an Id of a query is not found by the HTTP API." +ERROR_QUERY_IN_USE,1592,"query with this ID is in use","Will be raised when an Id of a query is found by the HTTP API but the query is in use." ################################################################################ ## ArangoDB cursor errors @@ -381,7 +381,7 @@ RESULT_ELEMENT_NOT_FOUND,10001,"element not found in structure","Will be returne ## dispatcher errors ################################################################################ -ERROR_QUEUE_ALREADY_EXISTS,21000,"named queue already exists", "Will be returned if a queue with this name already exists." +ERROR_QUEUE_ALREADY_EXISTS,21000,"named queue already exists","Will be returned if a queue with this name already exists." ERROR_DISPATCHER_IS_STOPPING,21001,"dispatcher stopped","Will be returned if a shutdown is in progress." ERROR_QUEUE_UNKNOWN,21002,"named queue does not exist","Will be returned if a queue with this name does not exist." ERROR_QUEUE_FULL,21003,"named queue is full","Will be returned if a queue with this name is full." From 90463a6666c3ce5d10982e3559d3587154b2e81d Mon Sep 17 00:00:00 2001 From: Andreas Streichardt Date: Fri, 3 Jun 2016 15:07:18 +0200 Subject: [PATCH 2/7] add user to database --- js/client/modules/@arangodb/testing.js | 1 + 1 file changed, 1 insertion(+) diff --git a/js/client/modules/@arangodb/testing.js b/js/client/modules/@arangodb/testing.js index c65873b0a7..d3f2740ee7 100644 --- a/js/client/modules/@arangodb/testing.js +++ b/js/client/modules/@arangodb/testing.js @@ -3205,6 +3205,7 @@ testFuncs.replication_static = function(options) { "--javascript.execute-string", "var users = require('@arangodb/users'); " + "users.save('replicator-user', 'replicator-password', true); " + + "users.grantDatabase('replicator-user', '_system'); " + "users.reload();" ]); From bae5caf23295f2fb59f0ec4480acf00fdedd7e73 Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Fri, 3 Jun 2016 15:12:44 +0200 Subject: [PATCH 3/7] Fix reference of string --- lib/ProgramOptions/Translator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ProgramOptions/Translator.cpp b/lib/ProgramOptions/Translator.cpp index 4f86266c3a..97e946d44d 100644 --- a/lib/ProgramOptions/Translator.cpp +++ b/lib/ProgramOptions/Translator.cpp @@ -56,7 +56,7 @@ std::string arangodb::options::EnvironmentTranslator(std::string const& value) { if (v == nullptr) { #if _WIN32 - if (TRI_EqualString(k, "ROOTDIR")) { + if (TRI_EqualString(k.c_str(), "ROOTDIR")) { vv = TRI_LocateInstallDirectory(); if (! vv.empty()) { From d7aeaaec22ff75062aad7fdd957a0cf1c073ddec Mon Sep 17 00:00:00 2001 From: Frank Celler Date: Fri, 3 Jun 2016 15:10:29 +0200 Subject: [PATCH 4/7] fixed null user --- js/actions/api-database.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/js/actions/api-database.js b/js/actions/api-database.js index bff1669bec..dceb78eea7 100644 --- a/js/actions/api-database.js +++ b/js/actions/api-database.js @@ -50,7 +50,11 @@ function get_api_database (req, res) { if (req.suffix[0] === 'user') { // fetch all databases for the current user // note: req.user may be null if authentication is turned off - result = arangodb.db._databases(req.user); + if (req.user === null) { + result = arangodb.db._databases(); + } else { + result = arangodb.db._databases(req.user); + } } else if (req.suffix[0] === 'current') { if (cluster.isCoordinator()) { From 04ef98f8b5275c70b1a39a9e5d2f1cf1a41c2c51 Mon Sep 17 00:00:00 2001 From: Frank Celler Date: Fri, 3 Jun 2016 15:14:54 +0200 Subject: [PATCH 5/7] removed outdated test --- UnitTests/HttpInterface/api-database-spec.rb | 7 ------- 1 file changed, 7 deletions(-) diff --git a/UnitTests/HttpInterface/api-database-spec.rb b/UnitTests/HttpInterface/api-database-spec.rb index 2801118b86..f3669088d7 100644 --- a/UnitTests/HttpInterface/api-database-spec.rb +++ b/UnitTests/HttpInterface/api-database-spec.rb @@ -210,13 +210,6 @@ describe ArangoDB do result["path"].should be_kind_of(String) result["isSystem"].should eq(false) - # retrieve user for new database - doc = ArangoDB.log_get("#{prefix}-create-current", "/_db/#{name}/_api/user/root") - doc.code.should eq(200) - result = doc.parsed_response - result["user"].should eq("root") - result["active"].should eq(true) - doc = ArangoDB.log_delete("#{prefix}-create-current", api + "/#{name}") doc.code.should eq(200) response = doc.parsed_response From 15afaebc128761e1fc62721e750e156ccf679c90 Mon Sep 17 00:00:00 2001 From: Frank Celler Date: Fri, 3 Jun 2016 15:21:15 +0200 Subject: [PATCH 6/7] fixed tests, fixed typo in exists --- UnitTests/HttpInterface/api-database-spec.rb | 12 ++---------- js/server/modules/@arangodb/users.js | 2 +- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/UnitTests/HttpInterface/api-database-spec.rb b/UnitTests/HttpInterface/api-database-spec.rb index f3669088d7..f1bf0b5797 100644 --- a/UnitTests/HttpInterface/api-database-spec.rb +++ b/UnitTests/HttpInterface/api-database-spec.rb @@ -244,7 +244,7 @@ describe ArangoDB do result["isSystem"].should eq(false) # retrieve information about user "admin" - doc = ArangoDB.log_get("#{prefix}-create-users", "/_db/#{name}/_api/user/admin") + doc = ArangoDB.log_get("#{prefix}-create-users", "/_db/_system/_api/user/admin") doc.code.should eq(200) result = doc.parsed_response result["user"].should eq("admin") @@ -252,16 +252,12 @@ describe ArangoDB do result["extra"]["gender"].should eq("m") # retrieve information about user "foxx" - doc = ArangoDB.log_get("#{prefix}-create-users", "/_db/#{name}/_api/user/foxx") + doc = ArangoDB.log_get("#{prefix}-create-users", "/_db/_system/_api/user/foxx") doc.code.should eq(200) result = doc.parsed_response result["user"].should eq("foxx") result["active"].should eq(false) - # retrieve information about user "root" - doc = ArangoDB.log_get("#{prefix}-create-users", "/_db/#{name}/_api/user/root") - doc.code.should eq(404) - doc = ArangoDB.log_delete("#{prefix}-create-users", api + "/#{name}") doc.code.should eq(200) response = doc.parsed_response @@ -305,10 +301,6 @@ describe ArangoDB do result["path"].should be_kind_of(String) result["isSystem"].should eq(false) - # retrieve information about user "root" - doc = ArangoDB.log_get("#{prefix}-create-users-invalid", "/_db/#{name}/_api/user/root") - doc.code.should eq(404) - doc = ArangoDB.log_delete("#{prefix}-create-users-invalid", api + "/#{name}") doc.code.should eq(200) response = doc.parsed_response diff --git a/js/server/modules/@arangodb/users.js b/js/server/modules/@arangodb/users.js index 69398b1d5a..9766ab39ac 100644 --- a/js/server/modules/@arangodb/users.js +++ b/js/server/modules/@arangodb/users.js @@ -312,7 +312,7 @@ exports.exists = function(username) { exports.document(username); return true; } catch (e) { - if (e.errNum === arangodb.errors.ERROR_USER_NOT_FOUND.code) { + if (e.errorNum === arangodb.errors.ERROR_USER_NOT_FOUND.code) { return false; } throw e; From ab5234ec9f4fac291257581cecb4aaea68b0db4a Mon Sep 17 00:00:00 2001 From: Frank Celler Date: Fri, 3 Jun 2016 15:28:35 +0200 Subject: [PATCH 7/7] fixed test --- js/common/tests/shell/shell-database.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/js/common/tests/shell/shell-database.js b/js/common/tests/shell/shell-database.js index 586fe1d947..0099a1f76c 100644 --- a/js/common/tests/shell/shell-database.js +++ b/js/common/tests/shell/shell-database.js @@ -280,7 +280,6 @@ function DatabaseSuite () { assertTrue(internal.db._createDatabase("UnitTestsDatabase0", { }, users)); - internal.db._useDatabase("UnitTestsDatabase0"); var userManager = require("@arangodb/users"); var user = userManager.document("admin"); @@ -293,8 +292,6 @@ function DatabaseSuite () { assertFalse(user.active); assertEqual("f", user.extra.gender); - internal.db._useDatabase("_system"); - assertTrue(internal.db._dropDatabase("UnitTestsDatabase0")); }, @@ -317,15 +314,12 @@ function DatabaseSuite () { ]; assertTrue(internal.db._createDatabase("UnitTestsDatabase0", { }, users)); - internal.db._useDatabase("UnitTestsDatabase0"); var userManager = require("@arangodb/users"); var user = userManager.document("admin"); assertEqual("admin", user.user); assertTrue(user.active); assertEqual("m", user.extra.gender); - internal.db._useDatabase("_system"); - assertTrue(internal.db._dropDatabase("UnitTestsDatabase0")); },