code: @Path("/{cuid}/rel/{relId}")
      @ApiOperation(value="Delete a user or remove a user from a workgroup or role",
          notes="If rel/{relId} is present, user is removed from workgroup or role.", response=StatusMessage.class)
      public JSONObject delete(String path, JSONObject content, Map<String,String> headers)
      throws ServiceException, JSONException {
          String cuid = getSegment(path, 1);
          String rel = getSegment(path, 2);
  
          UserServices userServices = ServiceLocator.getUserServices();
          try {
              if (rel == null) {
                  if (userServices.getUser(cuid) == null)
                      throw new ServiceException(ServiceException.NOT_FOUND, "User not found: " + cuid);
                  userServices.deleteUser(cuid);
              }
              else if (rel.equals("workgroups")) {
                  String group = getSegment(path, 3);
                  userServices.removeUserFromWorkgroup(cuid, group);
              }
              else if (rel.equals("roles")) {
                  String role = getSegment(path, 3);
                  userServices.removeUserFromRole(cuid, role);
              }
          }
          catch (DataAccessException ex) {
              throw new ServiceException(HTTP_500_INTERNAL_ERROR, ex.getMessage(), ex);
          }
          return null;
      }
docs: Delete a user or a user/group, user/role relationship.