Update remove permission

master
Rushdi Mohamed 3 years ago
parent 6ce4168d75
commit 6ccddf3f4b

@ -425,12 +425,15 @@ public class TraccarClientImpl implements TraccarClient {
try { try {
TrackerManagementDAOFactory.beginTransaction(); TrackerManagementDAOFactory.beginTransaction();
trackerDeviceInfo = trackerDAO.getTrackerDevice(deviceId, tenantId); trackerDeviceInfo = trackerDAO.getTrackerDevice(deviceId, tenantId);
trackerPermissionInfo = trackerDAO.getUserIdofPermissionByDeviceId(deviceId);
if(trackerDeviceInfo!=null){ if(trackerDeviceInfo!=null){
trackerDevice = new JSONObject(trackerDeviceInfo); trackerDevice = new JSONObject(trackerDeviceInfo);
trackerDAO.removeTrackerDevice(deviceId, tenantId); trackerDAO.removeTrackerDevice(deviceId, tenantId);
TrackerManagementDAOFactory.commitTransaction(); TrackerManagementDAOFactory.commitTransaction();
log.error(trackerDevice.getInt("traccarDeviceId"));
trackerPermissionInfo = trackerDAO.getUserIdofPermissionByDeviceId(trackerDevice.getInt("traccarDeviceId"));
log.error(trackerPermissionInfo);
log.error(new Gson().toJson(trackerPermissionInfo));
} }
} catch (TransactionManagementException e) { } catch (TransactionManagementException e) {
TrackerManagementDAOFactory.rollbackTransaction(); TrackerManagementDAOFactory.rollbackTransaction();
@ -456,11 +459,13 @@ public class TraccarClientImpl implements TraccarClient {
if(trackerPermissionInfo!=null){ if(trackerPermissionInfo!=null){
try { try {
removePermission(trackerPermissionInfo.getTraccarUserId(),deviceId); removePermission(trackerPermissionInfo.getTraccarUserId(),trackerDevice.getInt("traccarDeviceId"));
} catch (ExecutionException e) { } catch (ExecutionException e) {
throw new RuntimeException(e); log.error("ExecutionException : " + e);
//throw new RuntimeException(e);
} catch (InterruptedException e) { } catch (InterruptedException e) {
throw new RuntimeException(e); log.error("InterruptedException : " + e);
//throw new RuntimeException(e);
} }
} }
} }

Loading…
Cancel
Save