Commit 3ad9016c by nixonrodrigues

ATLAS-3329 : Update usage of Servlets.getUserName method to…

ATLAS-3329 : Update usage of Servlets.getUserName method to AtlasAuthorizationUtils.getCurrentUserName() Change-Id: I6bb6649ec9c82690d81f457de051a72eb9812850
parent 2c612bb8
...@@ -356,7 +356,7 @@ public class AdminResource { ...@@ -356,7 +356,7 @@ public class AdminResource {
ZipSink exportSink = null; ZipSink exportSink = null;
try { try {
exportSink = new ZipSink(httpServletResponse.getOutputStream()); exportSink = new ZipSink(httpServletResponse.getOutputStream());
AtlasExportResult result = exportService.run(exportSink, request, Servlets.getUserName(httpServletRequest), AtlasExportResult result = exportService.run(exportSink, request, AtlasAuthorizationUtils.getCurrentUserName(),
Servlets.getHostName(httpServletRequest), Servlets.getHostName(httpServletRequest),
AtlasAuthorizationUtils.getRequestIpAddress(httpServletRequest)); AtlasAuthorizationUtils.getRequestIpAddress(httpServletRequest));
...@@ -406,7 +406,7 @@ public class AdminResource { ...@@ -406,7 +406,7 @@ public class AdminResource {
AtlasImportRequest request = AtlasType.fromJson(jsonData, AtlasImportRequest.class); AtlasImportRequest request = AtlasType.fromJson(jsonData, AtlasImportRequest.class);
ZipSource zipSource = new ZipSource(inputStream); ZipSource zipSource = new ZipSource(inputStream);
result = importService.run(zipSource, request, Servlets.getUserName(httpServletRequest), result = importService.run(zipSource, request, AtlasAuthorizationUtils.getCurrentUserName(),
Servlets.getHostName(httpServletRequest), Servlets.getHostName(httpServletRequest),
AtlasAuthorizationUtils.getRequestIpAddress(httpServletRequest)); AtlasAuthorizationUtils.getRequestIpAddress(httpServletRequest));
} catch (AtlasBaseException excp) { } catch (AtlasBaseException excp) {
...@@ -449,7 +449,7 @@ public class AdminResource { ...@@ -449,7 +449,7 @@ public class AdminResource {
try { try {
AtlasImportRequest request = AtlasType.fromJson(jsonData, AtlasImportRequest.class); AtlasImportRequest request = AtlasType.fromJson(jsonData, AtlasImportRequest.class);
result = importService.run(request, Servlets.getUserName(httpServletRequest), result = importService.run(request, AtlasAuthorizationUtils.getCurrentUserName(),
Servlets.getHostName(httpServletRequest), Servlets.getHostName(httpServletRequest),
AtlasAuthorizationUtils.getRequestIpAddress(httpServletRequest)); AtlasAuthorizationUtils.getRequestIpAddress(httpServletRequest));
} catch (AtlasBaseException excp) { } catch (AtlasBaseException excp) {
......
...@@ -20,6 +20,7 @@ package org.apache.atlas.web.rest; ...@@ -20,6 +20,7 @@ package org.apache.atlas.web.rest;
import org.apache.atlas.AtlasClient; import org.apache.atlas.AtlasClient;
import org.apache.atlas.AtlasErrorCode; import org.apache.atlas.AtlasErrorCode;
import org.apache.atlas.SortOrder; import org.apache.atlas.SortOrder;
import org.apache.atlas.authorize.AtlasAuthorizationUtils;
import org.apache.atlas.discovery.AtlasDiscoveryService; import org.apache.atlas.discovery.AtlasDiscoveryService;
import org.apache.atlas.discovery.EntityDiscoveryService; import org.apache.atlas.discovery.EntityDiscoveryService;
import org.apache.atlas.exception.AtlasBaseException; import org.apache.atlas.exception.AtlasBaseException;
...@@ -398,7 +399,7 @@ public class DiscoveryREST { ...@@ -398,7 +399,7 @@ public class DiscoveryREST {
perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "DiscoveryREST.addSavedSearch(userName=" + savedSearch.getOwnerName() + ", name=" + savedSearch.getName() + ", searchType=" + savedSearch.getSearchType() + ")"); perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "DiscoveryREST.addSavedSearch(userName=" + savedSearch.getOwnerName() + ", name=" + savedSearch.getName() + ", searchType=" + savedSearch.getSearchType() + ")");
} }
return discoveryService.addSavedSearch(Servlets.getUserName(httpServletRequest), savedSearch); return discoveryService.addSavedSearch(AtlasAuthorizationUtils.getCurrentUserName(), savedSearch);
} finally { } finally {
AtlasPerfTracer.log(perf); AtlasPerfTracer.log(perf);
} }
...@@ -422,7 +423,7 @@ public class DiscoveryREST { ...@@ -422,7 +423,7 @@ public class DiscoveryREST {
perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "DiscoveryREST.updateSavedSearch(userName=" + savedSearch.getOwnerName() + ", name=" + savedSearch.getName() + ", searchType=" + savedSearch.getSearchType() + ")"); perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "DiscoveryREST.updateSavedSearch(userName=" + savedSearch.getOwnerName() + ", name=" + savedSearch.getName() + ", searchType=" + savedSearch.getSearchType() + ")");
} }
return discoveryService.updateSavedSearch(Servlets.getUserName(httpServletRequest), savedSearch); return discoveryService.updateSavedSearch(AtlasAuthorizationUtils.getCurrentUserName(), savedSearch);
} finally { } finally {
AtlasPerfTracer.log(perf); AtlasPerfTracer.log(perf);
} }
...@@ -449,7 +450,7 @@ public class DiscoveryREST { ...@@ -449,7 +450,7 @@ public class DiscoveryREST {
perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "DiscoveryREST.getSavedSearch(userName=" + userName + ", name=" + searchName + ")"); perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "DiscoveryREST.getSavedSearch(userName=" + userName + ", name=" + searchName + ")");
} }
return discoveryService.getSavedSearchByName(Servlets.getUserName(httpServletRequest), userName, searchName); return discoveryService.getSavedSearchByName(AtlasAuthorizationUtils.getCurrentUserName(), userName, searchName);
} finally { } finally {
AtlasPerfTracer.log(perf); AtlasPerfTracer.log(perf);
} }
...@@ -473,7 +474,7 @@ public class DiscoveryREST { ...@@ -473,7 +474,7 @@ public class DiscoveryREST {
perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "DiscoveryREST.getSavedSearches(userName=" + userName + ")"); perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "DiscoveryREST.getSavedSearches(userName=" + userName + ")");
} }
return discoveryService.getSavedSearches(Servlets.getUserName(httpServletRequest), userName); return discoveryService.getSavedSearches(AtlasAuthorizationUtils.getCurrentUserName(), userName);
} finally { } finally {
AtlasPerfTracer.log(perf); AtlasPerfTracer.log(perf);
} }
...@@ -494,7 +495,7 @@ public class DiscoveryREST { ...@@ -494,7 +495,7 @@ public class DiscoveryREST {
perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "DiscoveryREST.deleteSavedSearch(guid=" + guid + ")"); perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "DiscoveryREST.deleteSavedSearch(guid=" + guid + ")");
} }
discoveryService.deleteSavedSearch(Servlets.getUserName(httpServletRequest), guid); discoveryService.deleteSavedSearch(AtlasAuthorizationUtils.getCurrentUserName(), guid);
} finally { } finally {
AtlasPerfTracer.log(perf); AtlasPerfTracer.log(perf);
} }
...@@ -524,7 +525,7 @@ public class DiscoveryREST { ...@@ -524,7 +525,7 @@ public class DiscoveryREST {
"DiscoveryREST.executeSavedSearchByName(userName=" + userName + ", " + "name=" + searchName + ")"); "DiscoveryREST.executeSavedSearchByName(userName=" + userName + ", " + "name=" + searchName + ")");
} }
AtlasUserSavedSearch savedSearch = discoveryService.getSavedSearchByName(Servlets.getUserName(httpServletRequest), userName, searchName); AtlasUserSavedSearch savedSearch = discoveryService.getSavedSearchByName(AtlasAuthorizationUtils.getCurrentUserName(), userName, searchName);
return executeSavedSearch(savedSearch); return executeSavedSearch(savedSearch);
} finally { } finally {
...@@ -551,7 +552,7 @@ public class DiscoveryREST { ...@@ -551,7 +552,7 @@ public class DiscoveryREST {
perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "DiscoveryREST.executeSavedSearchByGuid(" + searchGuid + ")"); perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "DiscoveryREST.executeSavedSearchByGuid(" + searchGuid + ")");
} }
AtlasUserSavedSearch savedSearch = discoveryService.getSavedSearchByGuid(Servlets.getUserName(httpServletRequest), searchGuid); AtlasUserSavedSearch savedSearch = discoveryService.getSavedSearchByGuid(AtlasAuthorizationUtils.getCurrentUserName(), searchGuid);
return executeSavedSearch(savedSearch); return executeSavedSearch(savedSearch);
} finally { } finally {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment