diff --git a/pom.xml b/pom.xml
index e5ea611..6d2eb78 100644
--- a/pom.xml
+++ b/pom.xml
@@ -64,7 +64,7 @@
implementation we use a lighter dependency
-->
orientdb-client
- 3.2.6
+ 3.0.42
org.graalvm.tools
diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/dbinitialization/DatabaseEnvironment.java b/src/main/java/org/gcube/informationsystem/resourceregistry/dbinitialization/DatabaseEnvironment.java
index 6b741ba..40e7031 100644
--- a/src/main/java/org/gcube/informationsystem/resourceregistry/dbinitialization/DatabaseEnvironment.java
+++ b/src/main/java/org/gcube/informationsystem/resourceregistry/dbinitialization/DatabaseEnvironment.java
@@ -320,6 +320,8 @@ public class DatabaseEnvironment {
OUser newAdminUser = oSecurity.createUser(CHANGED_ADMIN_USERNAME, CHANGED_ADMIN_PASSWORD, adminRole);
newAdminUser.save();
+ DatabaseEnvironment.changeDefaultAdminPassword(oSecurity);
+
setRecordLevelSecurity(oMetadata);
oDatabaseSession.commit();
@@ -339,5 +341,28 @@ public class DatabaseEnvironment {
public static Key getDatabaseKey() {
return KEY;
}
+
+ @Deprecated
+ // This code must be removed for OrientDB versions higher than 3.2.X
+ public static void changeDefaultAdminPassword(OSecurity oSecurity) {
+ for(PermissionMode permissionMode : DEFAULT_PASSWORDS.keySet()) {
+ try {
+ logger.trace("Going to update password for user {}", permissionMode.toString());
+ OUser oUser = oSecurity.getUser(permissionMode.toString());
+ oUser.setPassword(DEFAULT_PASSWORDS.get(permissionMode));
+ oUser.save();
+ logger.trace("Updated password for user {}", permissionMode.toString());
+ }catch (Exception e) {
+ logger.trace("Unable to update password for user {}. {}", permissionMode.toString(), e.getMessage());
+ }
+ }
+
+ try {
+ logger.trace("Removing 'admin' user");
+ oSecurity.dropUser("admin");
+ }catch (Exception e) {
+ logger.info("Unable to delete admin user. {}", e.getMessage());
+ }
+ }
}