@SuppressWarnings({ "rawtypes", "unchecked" }) @Test public void testGetApps() { ResponseImpl resp = (ResponseImpl) resource.getApplications(""); List<Map> list = (List<Map>) resp.getEntity(); List<String> names = new ArrayList<String>(); for (Map map : list) { String name = (String) map.get("name"); names.add(name); } Assert.assertTrue(names.contains("MyApp")); }
@GET @RightsAllowed(any = true) public Response getApplications(@DefaultValue("") @QueryParam("is_admin") String adminFilter) { List<EntityBody> results = new ArrayList<EntityBody>(); NeutralQuery query = new NeutralQuery(0); for (Entity result : repo.findAll("application", query)) { if (appValidator.isAuthorizedForApp(result, SecurityUtil.getSLIPrincipal())) { EntityBody body = new EntityBody(result.getBody()); if (!shouldFilterApp(result, adminFilter)) { filterAttributes(body); results.add(body); } } } return Response.status(Status.OK).entity(results).build(); }
ApprovedApplicationResource { @GET @RightsAllowed(any = true) public Response getApplications(@DefaultValue("") @QueryParam("is_admin") String adminFilter) { List<EntityBody> results = new ArrayList<EntityBody>(); NeutralQuery query = new NeutralQuery(0); for (Entity result : repo.findAll("application", query)) { if (appValidator.isAuthorizedForApp(result, SecurityUtil.getSLIPrincipal())) { EntityBody body = new EntityBody(result.getBody()); if (!shouldFilterApp(result, adminFilter)) { filterAttributes(body); results.add(body); } } } return Response.status(Status.OK).entity(results).build(); } }
ApprovedApplicationResource { @GET @RightsAllowed(any = true) public Response getApplications(@DefaultValue("") @QueryParam("is_admin") String adminFilter) { List<EntityBody> results = new ArrayList<EntityBody>(); NeutralQuery query = new NeutralQuery(0); for (Entity result : repo.findAll("application", query)) { if (appValidator.isAuthorizedForApp(result, SecurityUtil.getSLIPrincipal())) { EntityBody body = new EntityBody(result.getBody()); if (!shouldFilterApp(result, adminFilter)) { filterAttributes(body); results.add(body); } } } return Response.status(Status.OK).entity(results).build(); }  }
ApprovedApplicationResource { @GET @RightsAllowed(any = true) public Response getApplications(@DefaultValue("") @QueryParam("is_admin") String adminFilter) { List<EntityBody> results = new ArrayList<EntityBody>(); NeutralQuery query = new NeutralQuery(0); for (Entity result : repo.findAll("application", query)) { if (appValidator.isAuthorizedForApp(result, SecurityUtil.getSLIPrincipal())) { EntityBody body = new EntityBody(result.getBody()); if (!shouldFilterApp(result, adminFilter)) { filterAttributes(body); results.add(body); } } } return Response.status(Status.OK).entity(results).build(); }  @GET @RightsAllowed(any = true) Response getApplications(@DefaultValue("") @QueryParam("is_admin") String adminFilter); }
ApprovedApplicationResource { @GET @RightsAllowed(any = true) public Response getApplications(@DefaultValue("") @QueryParam("is_admin") String adminFilter) { List<EntityBody> results = new ArrayList<EntityBody>(); NeutralQuery query = new NeutralQuery(0); for (Entity result : repo.findAll("application", query)) { if (appValidator.isAuthorizedForApp(result, SecurityUtil.getSLIPrincipal())) { EntityBody body = new EntityBody(result.getBody()); if (!shouldFilterApp(result, adminFilter)) { filterAttributes(body); results.add(body); } } } return Response.status(Status.OK).entity(results).build(); }  @GET @RightsAllowed(any = true) Response getApplications(@DefaultValue("") @QueryParam("is_admin") String adminFilter); static final String RESOURCE_NAME; }