diff --git a/server/src/main/java/com/arcadedb/server/security/ServerSecurity.java b/server/src/main/java/com/arcadedb/server/security/ServerSecurity.java index 6eb6b91122..81a1abb3db 100644 --- a/server/src/main/java/com/arcadedb/server/security/ServerSecurity.java +++ b/server/src/main/java/com/arcadedb/server/security/ServerSecurity.java @@ -24,6 +24,7 @@ import com.arcadedb.database.DatabaseInternal; import com.arcadedb.log.LogManager; import com.arcadedb.security.SecurityManager; +import com.arcadedb.serializer.json.JSONArray; import com.arcadedb.serializer.json.JSONException; import com.arcadedb.serializer.json.JSONObject; import com.arcadedb.server.ArcadeDBServer; @@ -125,7 +126,7 @@ public void loadUsers() { } } - if (users.isEmpty() || (users.containsKey("root") && users.get("root").getPassword() == null)) + if (users.isEmpty() || !users.containsKey("root") || (users.containsKey("root") && users.get("root").getPassword() == null)) askForRootPassword(); final long fileLastModified = usersRepository.getFileLastModified(); @@ -447,7 +448,9 @@ protected void askForRootPassword() throws IOException { getUser("root").setPassword(encodedPassword); saveUsers(); } else - createUser(new JSONObject().put("name", "root").put("password", encodedPassword)); + createUser(new JSONObject().put("name", "root") + .put("password", encodedPassword) + .put("databases", new JSONObject().put(SecurityManager.ANY, new JSONArray(new String[] { "admin" })))); } protected JSONObject getDatabaseGroupsConfiguration(final String databaseName) {