aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/helper
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2023-01-15 17:37:20 -0800
committerAnton Tananaev <anton@traccar.org>2023-01-15 17:37:30 -0800
commit1417098fa45a3060f17e0cca6d8226b12e7f174e (patch)
treec756c75b102dddb80e1b68190d24128727a3d96a /src/main/java/org/traccar/helper
parentdd25846efc91d53247f76b0afb8ee11b4fa8c341 (diff)
downloadtrackermap-server-1417098fa45a3060f17e0cca6d8226b12e7f174e.tar.gz
trackermap-server-1417098fa45a3060f17e0cca6d8226b12e7f174e.tar.bz2
trackermap-server-1417098fa45a3060f17e0cca6d8226b12e7f174e.zip
Remove default admin
Diffstat (limited to 'src/main/java/org/traccar/helper')
-rw-r--r--src/main/java/org/traccar/helper/model/UserUtil.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/main/java/org/traccar/helper/model/UserUtil.java b/src/main/java/org/traccar/helper/model/UserUtil.java
index 9919e1d95..9f93afeae 100644
--- a/src/main/java/org/traccar/helper/model/UserUtil.java
+++ b/src/main/java/org/traccar/helper/model/UserUtil.java
@@ -17,6 +17,11 @@ package org.traccar.helper.model;
import org.traccar.model.Server;
import org.traccar.model.User;
+import org.traccar.storage.Storage;
+import org.traccar.storage.StorageException;
+import org.traccar.storage.query.Columns;
+import org.traccar.storage.query.Order;
+import org.traccar.storage.query.Request;
import java.util.TimeZone;
@@ -25,6 +30,12 @@ public final class UserUtil {
private UserUtil() {
}
+ public static boolean isEmpty(Storage storage) throws StorageException {
+ return storage.getObjects(User.class, new Request(
+ new Columns.Include("id"),
+ new Order("id", false, 1))).isEmpty();
+ }
+
public static String getDistanceUnit(Server server, User user) {
return lookupStringAttribute(server, user, "distanceUnit", "km");
}