kumaab commented on code in PR #253:
URL: https://github.com/apache/ranger/pull/253#discussion_r1190725954


##########
security-admin/src/main/java/org/apache/ranger/rest/XUserREST.java:
##########
@@ -863,6 +868,49 @@ public void deleteXUserByUserName(@PathParam("userName") 
String userName,
                xUserMgr.deleteXUser(vxUser.getId(), forceDelete);
        }
 
+
+       /**
+        * Proceed with caution: Force deletes users in bulk from the ranger db,
+        * essentially serves as a cleanup Op for external users.
+        * <tt>Delete</tt> happens one at a time with immediate commit on the 
transaction.
+        */
+       @DELETE
+       @Path("/delete/external/users")
+       @PreAuthorize("hasRole('ROLE_SYS_ADMIN')")
+       @Produces({ "application/json" })
+       public Response deleteXUsers() {
+               if (!usersDeletionInProgress){
+                       synchronized (XUserREST.class) {
+                               usersDeletionInProgress = true;
+                               xUserMgr.bulkDeleteUsers();
+                               usersDeletionInProgress = false;
+                       }
+                       return Response.ok("External users deleted 
successfully").build();
+               }
+               return Response.ok("Users Deletion in progress, check ranger 
admin logs!").build();
+       }
+
+       /**
+        * Proceed with caution: Force deletes groups in bulk from the ranger 
db,
+        * essentially serves as a cleanup Op for external groups.
+        * <tt>Delete</tt> happens one at a time with immediate commit on the 
transaction.
+        */
+       @DELETE
+       @Path("/delete/external/groups")
+       @PreAuthorize("hasRole('ROLE_SYS_ADMIN')")
+       @Produces({ "application/json" })
+       public Response deleteXGroups() {

Review Comment:
   thanks for the suggestion, changes included in the latest patch. 



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