aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/api
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-12-20 22:01:32 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-12-20 22:01:32 +1300
commit9bcc4c7f4871b2b028d2bc2a8680ba14b2607eb6 (patch)
tree083c6b9877ef28ae9a1547309cbdb23e984da8ac /src/org/traccar/api
parentf04d420b323a324233c48d525254f1211afc0771 (diff)
downloadtraccar-server-9bcc4c7f4871b2b028d2bc2a8680ba14b2607eb6.tar.gz
traccar-server-9bcc4c7f4871b2b028d2bc2a8680ba14b2607eb6.tar.bz2
traccar-server-9bcc4c7f4871b2b028d2bc2a8680ba14b2607eb6.zip
Fix some REST API minor issues
Diffstat (limited to 'src/org/traccar/api')
-rw-r--r--src/org/traccar/api/BaseResource.java10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/org/traccar/api/BaseResource.java b/src/org/traccar/api/BaseResource.java
index 368df7166..aa1101f02 100644
--- a/src/org/traccar/api/BaseResource.java
+++ b/src/org/traccar/api/BaseResource.java
@@ -22,12 +22,12 @@ public class BaseResource {
@javax.ws.rs.core.Context
private SecurityContext securityContext;
- protected SecurityContext getSecurityContext() {
- return securityContext;
- }
-
protected long getUserId() {
- return ((UserPrincipal) securityContext.getUserPrincipal()).getUserId();
+ UserPrincipal principal = (UserPrincipal) securityContext.getUserPrincipal();
+ if (principal != null) {
+ return principal.getUserId();
+ }
+ return 0;
}
}