mneethiraj commented on code in PR #932:
URL: https://github.com/apache/ranger/pull/932#discussion_r3190856552


##########
security-admin/src/main/java/org/apache/ranger/biz/GdsDBStore.java:
##########
@@ -719,6 +719,27 @@ public RangerSharedResource 
updateSharedResource(RangerSharedResource resource)
         return ret;
     }
 
+    @Override
+    public void updateSharedResources(List<Long> sharedResourceIds) {

Review Comment:
   @rameeshm  - this method reads shared-resources and calls update with the 
value just read. What updates are performed here? The purpose of this API isn't 
clear.



##########
security-admin/src/main/java/org/apache/ranger/rest/GdsREST.java:
##########
@@ -1261,6 +1261,47 @@ public RangerSharedResource 
updateSharedResource(@PathParam("id") Long resourceI
         return ret;
     }
 
+    @PUT
+    @Path("/resources")
+    @Consumes("application/json")
+    @Produces("application/json")
+    @PreAuthorize("@rangerPreAuthSecurityHandler.isAPIAccessible(\"" + 
RangerAPIList.UPDATE_SHARED_RESOURCES + "\")")
+    public void updateSharedResources(@QueryParam("forceDelete") 
@DefaultValue("false") boolean forceDelete, List<Long> resourceIds) {
+        LOG.debug("==> GdsREST.updateSharedResources(resourceIds={}, 
forceDelete={})", resourceIds, forceDelete);
+
+        RangerPerfTracer perf = null;
+
+        try {
+            if (resourceIds == null) {
+                throw new Exception("resourceIds must not be null");
+            }
+
+            if (resourceIds.size() > SHARED_RESOURCES_MAX_BATCH_SIZE) {
+                throw new Exception("updateSharedResources batch size exceeded 
the configured limit: Maximum allowed is " + SHARED_RESOURCES_MAX_BATCH_SIZE);
+            }
+
+            if (RangerPerfTracer.isPerfTraceEnabled(PERF_LOG)) {
+                perf = RangerPerfTracer.getPerfTracer(PERF_LOG, 
"GdsREST.updateSharedResources(" + resourceIds + ",forceDelete=" + forceDelete 
+ ")");
+            }
+
+            if (forceDelete) {

Review Comment:
   The API is called `UPDATE_SHARED_RESOURCES`, but the flag is named a 
`forceDelete`. It will help to add a note on the purpose of this API.



-- 
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]

Reply via email to