diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-12-20 14:40:15 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-12-20 14:40:15 +1300 |
commit | 3eff91673944f202e0aebe20faa925011568b685 (patch) | |
tree | 8b3db829d90ca73faa132463eff8661a7335936f /src/org/traccar/api/BaseResource.java | |
parent | 4d29679dec4508d28af7651cdfd130e5a218b387 (diff) | |
download | trackermap-server-3eff91673944f202e0aebe20faa925011568b685.tar.gz trackermap-server-3eff91673944f202e0aebe20faa925011568b685.tar.bz2 trackermap-server-3eff91673944f202e0aebe20faa925011568b685.zip |
Check permissions for REST API calls
Diffstat (limited to 'src/org/traccar/api/BaseResource.java')
-rw-r--r-- | src/org/traccar/api/BaseResource.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/org/traccar/api/BaseResource.java b/src/org/traccar/api/BaseResource.java index 5a05c6732..368df7166 100644 --- a/src/org/traccar/api/BaseResource.java +++ b/src/org/traccar/api/BaseResource.java @@ -15,5 +15,19 @@ */ package org.traccar.api; +import javax.ws.rs.core.SecurityContext; + public class BaseResource { + + @javax.ws.rs.core.Context + private SecurityContext securityContext; + + protected SecurityContext getSecurityContext() { + return securityContext; + } + + protected long getUserId() { + return ((UserPrincipal) securityContext.getUserPrincipal()).getUserId(); + } + } |