diff --git a/security-admin/src/main/java/org/apache/ranger/rest/AssetREST.java b/security-admin/src/main/java/org/apache/ranger/rest/AssetREST.java index 2e1982c4a8..e5ef779f43 100644 --- a/security-admin/src/main/java/org/apache/ranger/rest/AssetREST.java +++ b/security-admin/src/main/java/org/apache/ranger/rest/AssetREST.java @@ -277,9 +277,26 @@ public VXLong countXAssets(@Context HttpServletRequest request) { logger.debug("==> AssetREST.countXAssets()"); } + SearchFilter filter = searchUtil.getSearchFilterFromLegacyRequest(request, xResourceService.sortFields); + + filter.setMaxRows(Integer.MAX_VALUE); + + List services = serviceREST.getServices(filter); + int servicesCount = 0; + + if (services != null) { + for (RangerService service : services) { + VXAsset asset = serviceUtil.toVXAsset(service); + + if (asset != null) { + servicesCount++; + } + } + } + VXLong ret = new VXLong(); - ret.setValue(searchXAssets(request).getListSize()); + ret.setValue(servicesCount); if(logger.isDebugEnabled()) { logger.debug("<== AssetREST.countXAssets(): " + ret);