use of se.inera.intyg.infra.security.common.model.Privilege in project webcert by sklintyg.
the class TakServiceImplTest method createUser.
private IntygUser createUser(String roleName, Privilege p, Map<String, Feature> features, String origin) {
IntygUser user = new IntygUser(HSAID_OK);
HashMap<String, Privilege> pMap = new HashMap<>();
pMap.put(p.getName(), p);
user.setAuthorities(pMap);
user.setOrigin(origin);
user.setFeatures(features);
HashMap<String, Role> rMap = new HashMap<>();
Role role = new Role();
role.setName(roleName);
rMap.put(roleName, role);
user.setRoles(rMap);
return user;
}
use of se.inera.intyg.infra.security.common.model.Privilege in project webcert by sklintyg.
the class UtkastApiControllerTest method setupUser.
private void setupUser(String privilegeString, String intygType, String... features) {
WebCertUser user = new WebCertUser();
user.setAuthorities(new HashMap<>());
user.getFeatures().putAll(Stream.of(features).collect(Collectors.toMap(Function.identity(), s -> {
Feature feature = new Feature();
feature.setName(s);
feature.setIntygstyper(Arrays.asList(intygType));
feature.setGlobal(true);
return feature;
})));
Privilege privilege = new Privilege();
privilege.setIntygstyper(Arrays.asList(intygType));
RequestOrigin requestOrigin = new RequestOrigin();
requestOrigin.setName("NORMAL");
requestOrigin.setIntygstyper(privilege.getIntygstyper());
privilege.setRequestOrigins(Arrays.asList(requestOrigin));
user.getAuthorities().put(privilegeString, privilege);
user.setOrigin("NORMAL");
user.setValdVardenhet(buildVardenhet());
user.setValdVardgivare(buildVardgivare());
when(webcertUserService.getUser()).thenReturn(user);
}
use of se.inera.intyg.infra.security.common.model.Privilege in project webcert by sklintyg.
the class IntygIntegrationControllerTest method createUser.
private WebCertUser createUser(String roleName, Privilege p, Map<String, Feature> features, String origin) {
WebCertUser user = new WebCertUser();
HashMap<String, Privilege> pMap = new HashMap<>();
pMap.put(p.getName(), p);
user.setAuthorities(pMap);
user.setOrigin(origin);
user.setFeatures(features);
HashMap<String, Role> rMap = new HashMap<>();
Role role = new Role();
role.setName(roleName);
rMap.put(roleName, role);
user.setRoles(rMap);
Vardgivare vg = new Vardgivare();
vg.setId("vg1");
Vardenhet ve = new Vardenhet();
ve.setVardgivareHsaId("vg1");
ve.setId(ENHETSID);
vg.setVardenheter(Arrays.asList(ve));
user.setVardgivare(Arrays.asList(vg));
return user;
}
use of se.inera.intyg.infra.security.common.model.Privilege in project webcert by sklintyg.
the class IntygIntegrationServiceImplTest method createUser.
private WebCertUser createUser(String roleName, Privilege p, Map<String, Feature> features, String origin) {
WebCertUser user = new WebCertUser();
HashMap<String, Privilege> pMap = new HashMap<>();
pMap.put(p.getName(), p);
user.setAuthorities(pMap);
user.setOrigin(origin);
user.setFeatures(features);
HashMap<String, Role> rMap = new HashMap<>();
Role role = new Role();
role.setName(roleName);
rMap.put(roleName, role);
user.setRoles(rMap);
return user;
}
use of se.inera.intyg.infra.security.common.model.Privilege in project webcert by sklintyg.
the class IntygIntegrationServiceImplTest method createPrivilege.
private Privilege createPrivilege(String name, List<String> intygsTyper, List<RequestOrigin> requestOrigins) {
Privilege p = new Privilege();
p.setName(name);
p.setIntygstyper(intygsTyper);
p.setRequestOrigins(requestOrigins);
return p;
}
Aggregations