aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/database
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-06-04 09:59:13 -0700
committerAnton Tananaev <anton@traccar.org>2022-06-04 09:59:13 -0700
commitfd84b0dcb86208c2c9c64fbe067cf7d4324892ac (patch)
tree4cab6727dba45c1a9610814df668c59783fff09b /src/main/java/org/traccar/database
parent4b0c47095c4fdd8d8b6849e36aac2761226b5b7e (diff)
downloadtrackermap-server-fd84b0dcb86208c2c9c64fbe067cf7d4324892ac.tar.gz
trackermap-server-fd84b0dcb86208c2c9c64fbe067cf7d4324892ac.tar.bz2
trackermap-server-fd84b0dcb86208c2c9c64fbe067cf7d4324892ac.zip
Remove ldap from context
Diffstat (limited to 'src/main/java/org/traccar/database')
-rw-r--r--src/main/java/org/traccar/database/DataManager.java13
-rw-r--r--src/main/java/org/traccar/database/LdapProvider.java2
2 files changed, 8 insertions, 7 deletions
diff --git a/src/main/java/org/traccar/database/DataManager.java b/src/main/java/org/traccar/database/DataManager.java
index 1426daea3..29d70ec32 100644
--- a/src/main/java/org/traccar/database/DataManager.java
+++ b/src/main/java/org/traccar/database/DataManager.java
@@ -25,6 +25,7 @@ import liquibase.exception.LiquibaseException;
import liquibase.resource.FileSystemResourceAccessor;
import liquibase.resource.ResourceAccessor;
import org.traccar.Context;
+import org.traccar.Main;
import org.traccar.config.Config;
import org.traccar.config.Keys;
import org.traccar.model.BaseModel;
@@ -131,12 +132,12 @@ public class DataManager {
config.getString(Keys.DATABASE_DRIVER),
null, null, null, resourceAccessor);
- Liquibase liquibase = new Liquibase(
- config.getString(Keys.DATABASE_CHANGELOG), resourceAccessor, database);
+ String changelog = config.getString(Keys.DATABASE_CHANGELOG);
- liquibase.clearCheckSums();
-
- liquibase.update(new Contexts());
+ try (Liquibase liquibase = new Liquibase(changelog, resourceAccessor, database)) {
+ liquibase.clearCheckSums();
+ liquibase.update(new Contexts());
+ }
}
}
@@ -146,7 +147,7 @@ public class DataManager {
new Condition.Or(
new Condition.Equals("email", "email", email.trim()),
new Condition.Equals("login", "email"))));
- LdapProvider ldapProvider = Context.getLdapProvider();
+ LdapProvider ldapProvider = Main.getInjector().getInstance(LdapProvider.class);
if (user != null) {
if (ldapProvider != null && user.getLogin() != null && ldapProvider.login(user.getLogin(), password)
|| !forceLdap && user.isPasswordValid(password)) {
diff --git a/src/main/java/org/traccar/database/LdapProvider.java b/src/main/java/org/traccar/database/LdapProvider.java
index d659a11a1..d517294b8 100644
--- a/src/main/java/org/traccar/database/LdapProvider.java
+++ b/src/main/java/org/traccar/database/LdapProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017 - 2020 Anton Tananaev (anton@traccar.org)
+ * Copyright 2017 - 2022 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.