diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2023-04-03 10:12:19 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-03 10:12:19 -0700 |
commit | 2d92fa2473b2317f01b904a8f1afd83e7884d7c8 (patch) | |
tree | 3ed8307268122fc23838f4c4ab97fb954c1c1370 /src/main/java/org/traccar/helper/model | |
parent | 836fb2221dedae55c3f8457f35294b3753f095c8 (diff) | |
parent | d05049c4fcad15b014d4d7178f3b88de7c0c7a28 (diff) | |
download | trackermap-server-2d92fa2473b2317f01b904a8f1afd83e7884d7c8.tar.gz trackermap-server-2d92fa2473b2317f01b904a8f1afd83e7884d7c8.tar.bz2 trackermap-server-2d92fa2473b2317f01b904a8f1afd83e7884d7c8.zip |
Merge pull request #5057 from dan-r/implement-oidc
Implement SSO with OpenID Connect
Diffstat (limited to 'src/main/java/org/traccar/helper/model')
-rw-r--r-- | src/main/java/org/traccar/helper/model/UserUtil.java | 10 |
1 files changed, 10 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 9f93afeae..4b1c404f9 100644 --- a/src/main/java/org/traccar/helper/model/UserUtil.java +++ b/src/main/java/org/traccar/helper/model/UserUtil.java @@ -15,6 +15,8 @@ */ package org.traccar.helper.model; +import org.traccar.config.Config; +import org.traccar.config.Keys; import org.traccar.model.Server; import org.traccar.model.User; import org.traccar.storage.Storage; @@ -23,6 +25,7 @@ import org.traccar.storage.query.Columns; import org.traccar.storage.query.Order; import org.traccar.storage.query.Request; +import java.util.Date; import java.util.TimeZone; public final class UserUtil { @@ -65,4 +68,11 @@ public final class UserUtil { return preference != null ? preference : defaultValue; } + public static void setUserDefaults(User user, Config config) { + user.setDeviceLimit(config.getInteger(Keys.USERS_DEFAULT_DEVICE_LIMIT)); + int expirationDays = config.getInteger(Keys.USERS_DEFAULT_EXPIRATION_DAYS); + if (expirationDays > 0) { + user.setExpirationTime(new Date(System.currentTimeMillis() + expirationDays * 86400000L)); + } + } } |