@Test public void testUserFeaturesDisableDisabled() { final WebUserFeaturesRequest webUserFeaturesRequest = new WebUserFeaturesRequest(); webUserFeaturesRequest.setJsLoggning(false); final HashMap<String, Feature> features = new HashMap<>(); when(webCertUser.getFeatures()).thenReturn(features); userApiController.userFeatures(webUserFeaturesRequest); verify(webCertUser, times(1)).setFeatures(captor.capture()); assertFalse(captor.getValue().containsKey(AuthoritiesConstants.FEATURE_JS_LOGGNING)); }
@PUT @Path("/features") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod public Response userFeatures(WebUserFeaturesRequest webUserFeaturesRequest) { WebCertUser user = getWebCertUserService().getUser(); Map<String, Feature> mutFeatures = new HashMap<>(user.getFeatures()); updateFeatures(webUserFeaturesRequest.isJsLoggning(), AuthoritiesConstants.FEATURE_JS_LOGGNING, mutFeatures); user.setFeatures(mutFeatures); return Response.ok(mutFeatures).build(); }
UserApiController extends AbstractApiController { @PUT @Path("/features") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod public Response userFeatures(WebUserFeaturesRequest webUserFeaturesRequest) { WebCertUser user = getWebCertUserService().getUser(); Map<String, Feature> mutFeatures = new HashMap<>(user.getFeatures()); updateFeatures(webUserFeaturesRequest.isJsLoggning(), AuthoritiesConstants.FEATURE_JS_LOGGNING, mutFeatures); user.setFeatures(mutFeatures); return Response.ok(mutFeatures).build(); } }
UserApiController extends AbstractApiController { @PUT @Path("/features") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod public Response userFeatures(WebUserFeaturesRequest webUserFeaturesRequest) { WebCertUser user = getWebCertUserService().getUser(); Map<String, Feature> mutFeatures = new HashMap<>(user.getFeatures()); updateFeatures(webUserFeaturesRequest.isJsLoggning(), AuthoritiesConstants.FEATURE_JS_LOGGNING, mutFeatures); user.setFeatures(mutFeatures); return Response.ok(mutFeatures).build(); }  }
UserApiController extends AbstractApiController { @PUT @Path("/features") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod public Response userFeatures(WebUserFeaturesRequest webUserFeaturesRequest) { WebCertUser user = getWebCertUserService().getUser(); Map<String, Feature> mutFeatures = new HashMap<>(user.getFeatures()); updateFeatures(webUserFeaturesRequest.isJsLoggning(), AuthoritiesConstants.FEATURE_JS_LOGGNING, mutFeatures); user.setFeatures(mutFeatures); return Response.ok(mutFeatures).build(); }  @GET @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod Response getUser(); @PUT @Path("/features") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod Response userFeatures(WebUserFeaturesRequest webUserFeaturesRequest); @POST @Path("/andraenhet") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod Response changeSelectedUnitOnUser(ChangeSelectedUnitRequest request); @PUT @Path("/godkannavtal") @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod Response godkannAvtal(); @DELETE @Path("/privatlakaravtal") @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod Response taBortAvtalsGodkannande(); @GET @Path("/latestavtal") @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod Response getAvtal(); @GET @Path("/ping") @PrometheusTimeMethod Response clientPing(); @PUT @Path("/preferences") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod Response storeUserMetdataEntry(WebUserPreferenceStorageRequest request); @DELETE @Path("/preferences/{key}") @PrometheusTimeMethod Response deleteUserPreferenceEntry(@PathParam("key") String prefKey); @GET @Path("/logout") @PrometheusTimeMethod Response logoutUserAfterTimeout(@Context HttpServletRequest request); @GET @Path("/logout/cancel") @PrometheusTimeMethod Response cancelLogout(@Context HttpServletRequest request); }
UserApiController extends AbstractApiController { @PUT @Path("/features") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod public Response userFeatures(WebUserFeaturesRequest webUserFeaturesRequest) { WebCertUser user = getWebCertUserService().getUser(); Map<String, Feature> mutFeatures = new HashMap<>(user.getFeatures()); updateFeatures(webUserFeaturesRequest.isJsLoggning(), AuthoritiesConstants.FEATURE_JS_LOGGNING, mutFeatures); user.setFeatures(mutFeatures); return Response.ok(mutFeatures).build(); }  @GET @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod Response getUser(); @PUT @Path("/features") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod Response userFeatures(WebUserFeaturesRequest webUserFeaturesRequest); @POST @Path("/andraenhet") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod Response changeSelectedUnitOnUser(ChangeSelectedUnitRequest request); @PUT @Path("/godkannavtal") @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod Response godkannAvtal(); @DELETE @Path("/privatlakaravtal") @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod Response taBortAvtalsGodkannande(); @GET @Path("/latestavtal") @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod Response getAvtal(); @GET @Path("/ping") @PrometheusTimeMethod Response clientPing(); @PUT @Path("/preferences") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod Response storeUserMetdataEntry(WebUserPreferenceStorageRequest request); @DELETE @Path("/preferences/{key}") @PrometheusTimeMethod Response deleteUserPreferenceEntry(@PathParam("key") String prefKey); @GET @Path("/logout") @PrometheusTimeMethod Response logoutUserAfterTimeout(@Context HttpServletRequest request); @GET @Path("/logout/cancel") @PrometheusTimeMethod Response cancelLogout(@Context HttpServletRequest request);  }