pradeepagrawal8184 commented on code in PR #683:
URL: https://github.com/apache/ranger/pull/683#discussion_r2402552416
##########
security-admin/src/main/java/org/apache/ranger/rest/ServiceREST.java:
##########
@@ -2852,6 +2852,48 @@ public RangerPluginInfoList getPluginsInfo(@Context
HttpServletRequest request)
return ret;
}
+ @DELETE
+ @Path("/plugins/info")
+ @Produces("application/json")
+ @PreAuthorize("hasRole('ROLE_SYS_ADMIN')")
+ public void deletePluginsInfo(@Context HttpServletRequest request) {
+ LOG.debug("==> ServiceREST.deletePluginsInfo()");
+
+ RangerPluginInfoList ret = null;
+ SearchFilter filter = searchUtil.getSearchFilter(request,
pluginInfoService.getSortFields());
+
+ try {
+ PList<RangerPluginInfo> paginatedPluginsInfo =
pluginInfoService.searchRangerPluginInfo(filter);
+ if (paginatedPluginsInfo != null) {
+ for (RangerPluginInfo rangerPluginInfo :
paginatedPluginsInfo.getList()) {
+ if (rangerPluginInfo != null) {
+ deletePluginsInfo(rangerPluginInfo.getId());
+ LOG.debug("Deleted rangerPluginInfo:[{}]",
rangerPluginInfo);
+ }
+ }
+ }
+ } catch (WebApplicationException excp) {
+ throw excp;
+ } catch (Throwable excp) {
+ LOG.error("deletePluginsInfo() failed", excp);
+
+ throw restErrorUtil.createRESTException(excp.getMessage());
+ }
+
+ LOG.debug("<== ServiceREST.deletePluginsInfo()");
+ }
+
+ @DELETE
+ @Path("/plugins/info/{id}")
+ @PreAuthorize("hasRole('ROLE_SYS_ADMIN')")
+ public void deletePluginsInfo(@PathParam("id") Long id) {
Review Comment:
This REST is designed keeping in the mind that option can be exposed in
future on the RANGER UI to delete the selected row. Currently there is no
option in the UI to delete the stale entries.
If this should not be exposed at all then we can remove the REST part of it
and make it private.
if the concern is that such REST APIs should not be there then there are
many such APIs which exists in ranger.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]