1
0
Fork 0

Merge branch 'devel' of github.com:arangodb/arangodb into devel

This commit is contained in:
hkernbach 2016-06-03 15:44:20 +02:00
commit bf494db64d
7 changed files with 23 additions and 39 deletions

View File

@ -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
@ -251,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")
@ -259,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
@ -312,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

View File

@ -50,8 +50,12 @@ 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
if (req.user === null) {
result = arangodb.db._databases();
} else {
result = arangodb.db._databases(req.user);
}
}
else if (req.suffix[0] === 'current') {
if (cluster.isCoordinator()) {
// fetch database information from Agency

View File

@ -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();"
]);

View File

@ -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"));
},

View File

@ -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;

View File

@ -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()) {