use of se.inera.intyg.infra.security.common.model.Feature in project webcert by sklintyg.
the class IntygIntegrationControllerTest method createDefaultUser.
private WebCertUser createDefaultUser() {
return createUser(AuthoritiesConstants.ROLE_LAKARE, createPrivilege(AuthoritiesConstants.PRIVILEGE_SKRIVA_INTYG, // p1 is restricted to these intygstyper
Arrays.asList("lisjp", "ts-bas"), Arrays.asList(createRequestOrigin(UserOriginType.DJUPINTEGRATION.name(), Arrays.asList("lisjp")), createRequestOrigin(UserOriginType.DJUPINTEGRATION.name(), Arrays.asList("ts-bas")))), Stream.of(AuthoritiesConstants.FEATURE_HANTERA_INTYGSUTKAST, "base_feature").collect(Collectors.toMap(Function.identity(), s -> {
Feature feature = new Feature();
feature.setName(s);
feature.setIntygstyper(Arrays.asList("lisjp"));
return feature;
})), UserOriginType.DJUPINTEGRATION.name());
}
use of se.inera.intyg.infra.security.common.model.Feature in project webcert by sklintyg.
the class IntygIntegrationServiceImplTest method createDefaultUser.
private WebCertUser createDefaultUser() {
return createUser(AuthoritiesConstants.ROLE_LAKARE, createPrivilege(AuthoritiesConstants.PRIVILEGE_SKRIVA_INTYG, // p1 is restricted to these intygstyper
Arrays.asList("lisjp", "ts-bas"), Arrays.asList(createRequestOrigin(UserOriginType.DJUPINTEGRATION.name(), Arrays.asList("lisjp")), createRequestOrigin(UserOriginType.DJUPINTEGRATION.name(), Arrays.asList("ts-bas")))), Stream.of(AuthoritiesConstants.FEATURE_HANTERA_INTYGSUTKAST, "base_feature").collect(Collectors.toMap(Function.identity(), s -> {
Feature feature = new Feature();
feature.setName(s);
feature.setIntygstyper(Arrays.asList("lisjp"));
return feature;
})), UserOriginType.DJUPINTEGRATION.name());
}
use of se.inera.intyg.infra.security.common.model.Feature in project webcert by sklintyg.
the class IntygModuleApiControllerTest method addFeatures.
private void addFeatures(WebCertUser user, String intygType, String... features) {
user.setFeatures(Stream.of(features).collect(Collectors.toMap(Function.identity(), s -> {
Feature feature = new Feature();
feature.setName(s);
feature.setIntygstyper(Arrays.asList(intygType));
return feature;
})));
}
use of se.inera.intyg.infra.security.common.model.Feature in project webcert by sklintyg.
the class FragaSvarModuleApiControllerTest method buildUser.
private WebCertUser buildUser() {
WebCertUser user = new WebCertUser();
user.setAuthorities(new HashMap<>());
user.getAuthorities().put(AuthoritiesConstants.PRIVILEGE_SKRIVA_INTYG, createPrivilege(AuthoritiesConstants.PRIVILEGE_SKRIVA_INTYG));
Feature feature = new Feature();
feature.setName(AuthoritiesConstants.FEATURE_HANTERA_FRAGOR);
feature.setIntygstyper(Arrays.asList(FK7263));
user.setFeatures(ImmutableMap.of(feature.getName(), feature));
user.setOrigin(UserOriginType.UTHOPP.name());
return user;
}
use of se.inera.intyg.infra.security.common.model.Feature in project webcert by sklintyg.
the class UserApiController method userFeatures.
@PUT
@Path("/features")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET)
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();
}
Aggregations