Example #1
0
  @PUT
  @Path("/permmaps")
  @Produces({"application/xml", "application/json"})
  @PreAuthorize(
      "@rangerPreAuthSecurityHandler.isAPIAccessible(\"" + RangerAPIList.UPDATE_X_PERM_MAP + "\")")
  public VXPermMap updateXPermMap(VXPermMap vXPermMap) {

    if (vXPermMap != null) {
      if (xResourceService.readResource(vXPermMap.getResourceId()) == null) {
        throw restErrorUtil.createRESTException(
            "Invalid Input Data - No resource found with Id: " + vXPermMap.getResourceId());
      }
    }

    return xUserMgr.updateXPermMap(vXPermMap);
  }
Example #2
0
  // Handle XPermMap
  @GET
  @Path("/permmaps/{id}")
  @Produces({"application/xml", "application/json"})
  @PreAuthorize(
      "@rangerPreAuthSecurityHandler.isAPIAccessible(\"" + RangerAPIList.GET_X_PERM_MAP + "\")")
  public VXPermMap getXPermMap(@PathParam("id") Long id) {
    VXPermMap permMap = xUserMgr.getXPermMap(id);

    if (permMap != null) {
      if (xResourceService.readResource(permMap.getResourceId()) == null) {
        throw restErrorUtil.createRESTException(
            "Invalid Input Data - No resource found with Id: " + permMap.getResourceId(),
            MessageEnums.INVALID_INPUT_DATA);
      }
    }

    return permMap;
  }