Search in sources :

Example 16 with Feature

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());
}
Also used : Feature(se.inera.intyg.infra.security.common.model.Feature)

Example 17 with Feature

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());
}
Also used : Feature(se.inera.intyg.infra.security.common.model.Feature)

Example 18 with Feature

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;
    })));
}
Also used : Feature(se.inera.intyg.infra.security.common.model.Feature)

Example 19 with 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;
}
Also used : Feature(se.inera.intyg.infra.security.common.model.Feature) WebCertUser(se.inera.intyg.webcert.web.service.user.dto.WebCertUser)

Example 20 with Feature

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();
}
Also used : HashMap(java.util.HashMap) Feature(se.inera.intyg.infra.security.common.model.Feature) WebCertUser(se.inera.intyg.webcert.web.service.user.dto.WebCertUser) Path(javax.ws.rs.Path) Consumes(javax.ws.rs.Consumes) Produces(javax.ws.rs.Produces) PUT(javax.ws.rs.PUT)

Aggregations

Feature (se.inera.intyg.infra.security.common.model.Feature)25 WebCertUser (se.inera.intyg.webcert.web.service.user.dto.WebCertUser)13 Test (org.junit.Test)10 HashMap (java.util.HashMap)6 WebUserFeaturesRequest (se.inera.intyg.webcert.web.web.controller.api.dto.WebUserFeaturesRequest)4 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)2 Privilege (se.inera.intyg.infra.security.common.model.Privilege)2 RequestOrigin (se.inera.intyg.infra.security.common.model.RequestOrigin)2 Utkast (se.inera.intyg.webcert.persistence.utkast.model.Utkast)2 Consumes (javax.ws.rs.Consumes)1 PUT (javax.ws.rs.PUT)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1 Vardenhet (se.inera.intyg.infra.integration.hsa.model.Vardenhet)1 Vardgivare (se.inera.intyg.infra.integration.hsa.model.Vardgivare)1 Role (se.inera.intyg.infra.security.common.model.Role)1 WebCertServiceException (se.inera.intyg.webcert.common.service.exception.WebCertServiceException)1 Signatur (se.inera.intyg.webcert.persistence.utkast.model.Signatur)1 LogRequest (se.inera.intyg.webcert.web.service.log.dto.LogRequest)1 SignaturTicket (se.inera.intyg.webcert.web.service.signatur.dto.SignaturTicket)1