aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2023-05-22 17:21:52 -0700
committerAnton Tananaev <anton@traccar.org>2023-05-22 17:21:52 -0700
commite94e7f55aae161cf2fd30bbb2ca217f23627b074 (patch)
tree4d85660949b500c685bcc3a46558ecd9942159d9 /src/main/java/org
parent48dae92ed4cda1acdb76f0a9250f545f3bca977a (diff)
downloadtrackermap-server-e94e7f55aae161cf2fd30bbb2ca217f23627b074.tar.gz
trackermap-server-e94e7f55aae161cf2fd30bbb2ca217f23627b074.tar.bz2
trackermap-server-e94e7f55aae161cf2fd30bbb2ca217f23627b074.zip
Add SMS enabled flag
Diffstat (limited to 'src/main/java/org')
-rw-r--r--src/main/java/org/traccar/api/resource/ServerResource.java8
-rw-r--r--src/main/java/org/traccar/model/Server.java14
2 files changed, 20 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/api/resource/ServerResource.java b/src/main/java/org/traccar/api/resource/ServerResource.java
index 6a3b8919e..f334b7a21 100644
--- a/src/main/java/org/traccar/api/resource/ServerResource.java
+++ b/src/main/java/org/traccar/api/resource/ServerResource.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2022 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2023 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.
@@ -25,6 +25,7 @@ import org.traccar.helper.LogAction;
import org.traccar.model.Server;
import org.traccar.model.User;
import org.traccar.session.cache.CacheManager;
+import org.traccar.sms.SmsManager;
import org.traccar.storage.StorageException;
import org.traccar.storage.query.Columns;
import org.traccar.storage.query.Condition;
@@ -58,6 +59,10 @@ public class ServerResource extends BaseResource {
@Inject
@Nullable
+ private SmsManager smsManager;
+
+ @Inject
+ @Nullable
private OpenIdProvider openIdProvider;
@Inject
@@ -69,6 +74,7 @@ public class ServerResource extends BaseResource {
public Server get() throws StorageException {
Server server = storage.getObject(Server.class, new Request(new Columns.All()));
server.setEmailEnabled(mailManager.getEmailEnabled());
+ server.setTextEnabled(smsManager != null);
server.setGeocoderEnabled(geocoder != null);
server.setOpenIdEnabled(openIdProvider != null);
server.setOpenIdForce(openIdProvider != null && openIdProvider.getForce());
diff --git a/src/main/java/org/traccar/model/Server.java b/src/main/java/org/traccar/model/Server.java
index b790ca472..6442186b6 100644
--- a/src/main/java/org/traccar/model/Server.java
+++ b/src/main/java/org/traccar/model/Server.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2022 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2023 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.
@@ -228,6 +228,18 @@ public class Server extends ExtendedModel implements UserRestrictions {
private boolean geocoderEnabled;
+ private boolean textEnabled;
+
+ @QueryIgnore
+ public void setTextEnabled(boolean textEnabled) {
+ this.textEnabled = textEnabled;
+ }
+
+ @QueryIgnore
+ public Boolean getTextEnabled() {
+ return textEnabled;
+ }
+
@QueryIgnore
public void setGeocoderEnabled(boolean geocoderEnabled) {
this.geocoderEnabled = geocoderEnabled;