aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/database/DeviceManager.java
diff options
context:
space:
mode:
authorEdward Valley <ed.valley@yandex.com>2019-07-17 11:58:45 -0400
committerEdward Valley <ed.valley@yandex.com>2019-07-18 14:04:01 -0400
commit96d8ea7322d1a588dd2d4cfac73d5c049ebe3faf (patch)
tree367e093472e63fbbd921df752af6f34638f3c281 /src/main/java/org/traccar/database/DeviceManager.java
parent509d26db7efafe965f5cc6e1a1fba6b30e9556cf (diff)
downloadtrackermap-server-96d8ea7322d1a588dd2d4cfac73d5c049ebe3faf.tar.gz
trackermap-server-96d8ea7322d1a588dd2d4cfac73d5c049ebe3faf.tar.bz2
trackermap-server-96d8ea7322d1a588dd2d4cfac73d5c049ebe3faf.zip
Make device password group configurable
Diffstat (limited to 'src/main/java/org/traccar/database/DeviceManager.java')
-rw-r--r--src/main/java/org/traccar/database/DeviceManager.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/database/DeviceManager.java b/src/main/java/org/traccar/database/DeviceManager.java
index d5b1c8c0d..51f35b3db 100644
--- a/src/main/java/org/traccar/database/DeviceManager.java
+++ b/src/main/java/org/traccar/database/DeviceManager.java
@@ -116,13 +116,20 @@ public class DeviceManager extends BaseObjectManager<Device> implements Identity
}
@Override
- public String getDevicePassword(long id, String defaultPassword) {
+ public String getDevicePassword(long id, String protocol, String defaultPassword) {
- String password = getById(id).getString(Command.KEY_DEVICE_PASSWORD);
+ String password = lookupAttributeString(id, Command.KEY_DEVICE_PASSWORD, null, false);
if (password != null) {
return password;
}
+ if (protocol != null) {
+ password = Context.getConfig().getString(protocol + "." + Command.KEY_DEVICE_PASSWORD);
+ if (password != null) {
+ return password;
+ }
+ }
+
return defaultPassword;
}