Skip to content

Commit

Permalink
fix: make sure to get env root password when root user exists
Browse files Browse the repository at this point in the history
  • Loading branch information
tglman committed Aug 26, 2024
1 parent d0fbf9e commit 8750468
Showing 1 changed file with 16 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -946,25 +946,26 @@ protected void createDefaultServerUsers() throws IOException {

OSecuritySystem securitySystem = databases.getSecuritySystem();
if (securitySystem != null && !securitySystem.arePasswordsStored()) {
if (envRootPassword != null) {
final String pwd = envRootPassword;
getSystemDatabase()
.executeWithDB(
(db) -> {
db.command(
"update OUser set password= ? WHERE name = ?",
pwd,
OServerConfiguration.DEFAULT_ROOT_USER)
.close();
return (Void) null;
});
}
return;
}

boolean existServerUser = existsSystemUser(OServerConfiguration.DEFAULT_ROOT_USER);
if (existServerUser && envRootPassword != null) {
final String pwd = envRootPassword;
getSystemDatabase()
.executeWithDB(
(db) -> {
db.command(
"update OUser set password= ? WHERE name = ?",
pwd,
OServerConfiguration.DEFAULT_ROOT_USER)
.close();
return (Void) null;
});
}

boolean existsRoot =
existsSystemUser(OServerConfiguration.DEFAULT_ROOT_USER)
|| serverCfg.existsUser(OServerConfiguration.DEFAULT_ROOT_USER);
serverCfg.existsUser(OServerConfiguration.DEFAULT_ROOT_USER) || existServerUser;

if (envRootPassword == null && !existsRoot) {
try {
Expand Down

0 comments on commit 8750468

Please sign in to comment.