Upgrade to OrientDB 3.2.5 (from 3.0.38)
This commit is contained in:
parent
52d2df21fd
commit
41f41d8179
4
pom.xml
4
pom.xml
|
@ -56,10 +56,10 @@
|
|||
To work with Thinkerpop® it is required to use this artifactId
|
||||
<artifactId>orientdb-graphdb</artifactId>
|
||||
Giving that we just use OrientDB classes and not Thinkerpop®
|
||||
implementation we use a lighter dependecy
|
||||
implementation we use a lighter dependency
|
||||
-->
|
||||
<artifactId>orientdb-client</artifactId>
|
||||
<version>3.0.38</version>
|
||||
<version>3.2.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.common</groupId>
|
||||
|
|
|
@ -84,17 +84,11 @@ public class DatabaseEnvironment {
|
|||
private static final String ROOT_PASSWORD;
|
||||
private static final String ROOT_PASSWORD_VARNAME = "ROOT_PASSWORD";
|
||||
|
||||
private static final String DEFAULT_ADMIN_USERNAME;
|
||||
private static final String DEFAULT_ADMIN_USERNAME_VARNAME = "DEFAULT_ADMIN_USERNAME";
|
||||
|
||||
public static final String DEFAULT_ADMIN_ROLE = "admin";
|
||||
|
||||
private static final String CHANGED_ADMIN_USERNAME;
|
||||
private static final String CHANGED_ADMIN_USERNAME_VARNAME = "CHANGED_ADMIN_USERNAME";
|
||||
|
||||
private static final String DEFAULT_ADMIN_PASSWORD;
|
||||
private static final String DEFAULT_ADMIN_PASSWORD_VARNAME = "DEFAULT_ADMIN_PASSWORD";
|
||||
|
||||
private static final String CHANGED_ADMIN_PASSWORD;
|
||||
private static final String CHANGED_ADMIN_PASSWORD_VARNAME = "CHANGED_ADMIN_PASSWORD";
|
||||
|
||||
|
@ -164,9 +158,6 @@ public class DatabaseEnvironment {
|
|||
DEFAULT_CREATED_WRITER_USER_PASSWORD = properties.getProperty(DEFAULT_CREATED_WRITER_USER_PASSWORD_VARNAME);
|
||||
DEFAULT_CREATED_READER_USER_PASSWORD = properties.getProperty(DEFAULT_CREATED_READER_USER_PASSWORD_VARNAME);
|
||||
|
||||
DEFAULT_ADMIN_USERNAME = properties.getProperty(DEFAULT_ADMIN_USERNAME_VARNAME);
|
||||
DEFAULT_ADMIN_PASSWORD = properties.getProperty(DEFAULT_ADMIN_PASSWORD_VARNAME);
|
||||
|
||||
DEFAULT_PASSWORDS = new HashMap<PermissionMode,String>();
|
||||
|
||||
DEFAULT_PASSWORDS.put(PermissionMode.WRITER, DEFAULT_CREATED_WRITER_USER_PASSWORD);
|
||||
|
@ -302,10 +293,7 @@ public class DatabaseEnvironment {
|
|||
logger.info("The database {} does not exist. Going to create it.", DB_URI);
|
||||
orientDB.create(DB, ODatabaseType.PLOCAL);
|
||||
|
||||
logger.trace("Connecting to newly created database {} as {} with default password", DB_URI,
|
||||
DEFAULT_ADMIN_USERNAME);
|
||||
|
||||
ODatabasePool pool = new ODatabasePool(orientDB, DB, DEFAULT_ADMIN_USERNAME, DEFAULT_ADMIN_PASSWORD);
|
||||
ODatabasePool pool = new ODatabasePool(orientDB, DB, ROOT_USERNAME, ROOT_PASSWORD);
|
||||
ODatabaseSession oDatabaseSession = pool.acquire();
|
||||
|
||||
DatabaseEnvironment.setDateTimeFormat(oDatabaseSession);
|
||||
|
@ -313,24 +301,12 @@ public class DatabaseEnvironment {
|
|||
OMetadata oMetadata = oDatabaseSession.getMetadata();
|
||||
OSecurity oSecurity = oMetadata.getSecurity();
|
||||
|
||||
logger.trace("Changing {} password", DEFAULT_ADMIN_USERNAME);
|
||||
|
||||
OUser admin = oSecurity.getUser(DEFAULT_ADMIN_USERNAME);
|
||||
admin.setPassword(CHANGED_ADMIN_PASSWORD);
|
||||
admin.save();
|
||||
|
||||
logger.trace("Creating new admin named '{}'", CHANGED_ADMIN_USERNAME);
|
||||
ORole adminRole = oSecurity.getRole(DEFAULT_ADMIN_ROLE);
|
||||
OUser newAdminUser = oSecurity.createUser(CHANGED_ADMIN_USERNAME, CHANGED_ADMIN_PASSWORD, adminRole);
|
||||
newAdminUser.save();
|
||||
|
||||
for(PermissionMode permissionMode : DEFAULT_PASSWORDS.keySet()) {
|
||||
OUser oUser = oSecurity.getUser(permissionMode.toString());
|
||||
oUser.setPassword(DEFAULT_PASSWORDS.get(permissionMode));
|
||||
oUser.save();
|
||||
logger.trace("Updating password for user {}", permissionMode.toString());
|
||||
}
|
||||
|
||||
logger.trace(
|
||||
"Setting Record-level Security (see http://orientdb.com/docs/3.0.x/security/Database-Security.html#record-level-security)");
|
||||
OSchema oSchema = oMetadata.getSchema();
|
||||
|
|
Loading…
Reference in New Issue