From 6b3294bd6013fa855213bc6c88afed9c02a55227 Mon Sep 17 00:00:00 2001 From: Rushdi Date: Tue, 17 May 2022 21:42:06 +0530 Subject: [PATCH] Update tracker get token api --- .../mgt/jaxrs/service/api/DeviceManagementService.java | 9 +-------- .../jaxrs/service/impl/DeviceManagementServiceImpl.java | 6 ++++-- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceManagementService.java index 02efa62f237..8ea4cd2f323 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceManagementService.java @@ -634,14 +634,7 @@ public interface DeviceManagementService { response = ErrorResponse.class) }) @Path("/traccar-user-token") - Response getTraccarUserToken( - @ApiParam( - name = "name", - value = "Boolean flag indicating whether to include device-info (location, application list etc) \n" + - " to the device object.", - required = false) - @QueryParam("name") - String name); + Response getTraccarUserToken(); @GET @Produces(MediaType.APPLICATION_JSON) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/DeviceManagementServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/DeviceManagementServiceImpl.java index bebef1bcf02..c57f0463da6 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/DeviceManagementServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/DeviceManagementServiceImpl.java @@ -469,12 +469,14 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { @GET @Override @Path("/traccar-user-token") - public Response getTraccarUserToken(@QueryParam("name") String name) { + public Response getTraccarUserToken() { if (HttpReportingUtil.isTrackerEnabled()) { - JSONObject obj = new JSONObject(DeviceAPIClientServiceImpl.returnUser(name)); + String loggedUserName = CarbonContext.getThreadLocalCarbonContext().getUsername(); + JSONObject obj = new JSONObject(DeviceAPIClientServiceImpl.returnUser(loggedUserName)); log.info("================="); + log.info(loggedUserName); log.info(obj.toString()); log.info("=================="); if(obj.has("error")){