aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormeysamrt <46737899+MeysamRT76@users.noreply.github.com>2024-02-18 16:44:28 +0330
committerGitHub <noreply@github.com>2024-02-18 16:44:28 +0330
commit5a5a0e43d3b123780775f723c1c35a417a4e8265 (patch)
treefab07d641f253483a4c898d09d26475dd089f5f4
parenta8ab00a53f8015df041ced9ba012294cea1068e5 (diff)
downloadtrackermap-server-5a5a0e43d3b123780775f723c1c35a417a4e8265.tar.gz
trackermap-server-5a5a0e43d3b123780775f723c1c35a417a4e8265.tar.bz2
trackermap-server-5a5a0e43d3b123780775f723c1c35a417a4e8265.zip
Refactor: Remove duplicated code in get function (ServerResource.java)
Eliminate duplicated code in get function to enhance maintainability and readability.
-rw-r--r--src/main/java/org/traccar/api/resource/ServerResource.java9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/main/java/org/traccar/api/resource/ServerResource.java b/src/main/java/org/traccar/api/resource/ServerResource.java
index 66ecc74e1..76c8e14c7 100644
--- a/src/main/java/org/traccar/api/resource/ServerResource.java
+++ b/src/main/java/org/traccar/api/resource/ServerResource.java
@@ -93,15 +93,10 @@ public class ServerResource extends BaseResource {
server.setOpenIdEnabled(openIdProvider != null);
server.setOpenIdForce(openIdProvider != null && openIdProvider.getForce());
User user = permissionsService.getUser(getUserId());
- if (user != null) {
- if (user.getAdministrator()) {
- server.setStorageSpace(Log.getStorageSpace());
- }
- } else {
- server.setNewServer(UserUtil.isEmpty(storage));
- }
if (user != null && user.getAdministrator()) {
server.setStorageSpace(Log.getStorageSpace());
+ } else {
+ server.setNewServer(UserUtil.isEmpty(storage));
}
return server;
}