Example #1
0
 @DELETE
 @Path("/secure/groups/delete")
 @Produces({"application/xml", "application/json"})
 @PreAuthorize("hasRole('ROLE_SYS_ADMIN')")
 public void deleteGroupsByGroupName(@Context HttpServletRequest request, VXStringList groupList) {
   String forceDeleteStr = request.getParameter("forceDelete");
   boolean forceDelete = false;
   if (StringUtils.isNotEmpty(forceDeleteStr) && "true".equalsIgnoreCase(forceDeleteStr)) {
     forceDelete = true;
   }
   if (groupList != null && groupList.getList() != null) {
     for (VXString groupName : groupList.getList()) {
       if (StringUtils.isNotEmpty(groupName.getValue())) {
         VXGroup vxGroup = xGroupService.getGroupByGroupName(groupName.getValue());
         xUserMgr.deleteXGroup(vxGroup.getId(), forceDelete);
       }
     }
   }
 }
Example #2
0
 @DELETE
 @Path("/secure/users/delete")
 @Produces({"application/xml", "application/json"})
 @PreAuthorize("hasRole('ROLE_SYS_ADMIN')")
 public void deleteUsersByUserName(@Context HttpServletRequest request, VXStringList userList) {
   String forceDeleteStr = request.getParameter("forceDelete");
   boolean forceDelete = false;
   if (StringUtils.isNotEmpty(forceDeleteStr) && "true".equalsIgnoreCase(forceDeleteStr)) {
     forceDelete = true;
   }
   if (userList != null && userList.getList() != null) {
     for (VXString userName : userList.getList()) {
       if (StringUtils.isNotEmpty(userName.getValue())) {
         VXUser vxUser = xUserService.getXUserByUserName(userName.getValue());
         xUserMgr.deleteXUser(vxUser.getId(), forceDelete);
       }
     }
   }
 }
Example #3
0
 @PUT
 @Path("/secure/users/roles/userName/{userName}")
 @Produces({"application/xml", "application/json"})
 @PreAuthorize(
     "@rangerPreAuthSecurityHandler.isAPIAccessible(\""
         + RangerAPIList.SET_USER_ROLES_BY_NAME
         + "\")")
 public VXStringList setUserRolesByName(
     @PathParam("userName") String userName, VXStringList roleList) {
   return xUserMgr.setUserRolesByName(userName, roleList.getVXStrings());
 }
Example #4
0
 @PUT
 @Path("/secure/users/roles/{userId}")
 @Produces({"application/xml", "application/json"})
 @PreAuthorize(
     "@rangerPreAuthSecurityHandler.isAPIAccessible(\""
         + RangerAPIList.SET_USER_ROLES_BY_ID
         + "\")")
 public VXStringList setUserRolesByExternalID(
     @PathParam("userId") Long userId, VXStringList roleList) {
   return xUserMgr.setUserRolesByExternalID(userId, roleList.getVXStrings());
 }