diff options
Diffstat (limited to 'src/main/java/org/traccar/api/BaseResource.java')
-rw-r--r-- | src/main/java/org/traccar/api/BaseResource.java | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/api/BaseResource.java b/src/main/java/org/traccar/api/BaseResource.java index cc272df9c..33abe73fa 100644 --- a/src/main/java/org/traccar/api/BaseResource.java +++ b/src/main/java/org/traccar/api/BaseResource.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 - 2017 Anton Tananaev (anton@traccar.org) + * Copyright 2015 - 2022 Anton Tananaev (anton@traccar.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,13 +15,25 @@ */ package org.traccar.api; +import org.traccar.api.security.PermissionsService; +import org.traccar.api.security.UserPrincipal; +import org.traccar.storage.Storage; + +import javax.inject.Inject; +import javax.ws.rs.core.Context; import javax.ws.rs.core.SecurityContext; public class BaseResource { - @javax.ws.rs.core.Context + @Context private SecurityContext securityContext; + @Inject + protected Storage storage; + + @Inject + protected PermissionsService permissionsService; + protected long getUserId() { UserPrincipal principal = (UserPrincipal) securityContext.getUserPrincipal(); if (principal != null) { @@ -29,4 +41,5 @@ public class BaseResource { } return 0; } + } |