use of com.odysseusinc.arachne.commons.api.v1.dto.CommonUserRegistrationDTO in project ArachneCentralAPI by OHDSI.
the class BaseUserController method create.
@ApiOperation("Create new user")
@RequestMapping(value = "/api/v1/admin/users", method = POST)
public CommonUserDTO create(@RequestBody @Valid CommonUserRegistrationDTO dto) throws PasswordValidationException {
CommonUserDTO result;
U user = convertRegistrationDTO(dto);
user.setEmailConfirmed(false);
user = userService.create(user);
result = conversionService.convert(user, CommonUserDTO.class);
return result;
}
use of com.odysseusinc.arachne.commons.api.v1.dto.CommonUserRegistrationDTO in project ArachneCentralAPI by OHDSI.
the class UserControllerTests method testCreateUser.
@Test
@DatabaseSetup("/data/user/admin-user.xml")
@ExpectedDatabase(value = "/data/user/registered-user-and-admin.xml", assertionMode = DatabaseAssertionMode.NON_STRICT)
public void testCreateUser() throws Exception {
CommonUserRegistrationDTO inputDTO = getCommonUserRegistrationDTO(PASSWORD);
MvcResult mvcResult = mvc.perform(post("/api/v1/auth/registration").contentType(APPLICATION_JSON).content(objectMapper.writeValueAsBytes(inputDTO)).with(anonymous())).andExpect(OK_STATUS).andReturn();
}
use of com.odysseusinc.arachne.commons.api.v1.dto.CommonUserRegistrationDTO in project ArachneCentralAPI by OHDSI.
the class UserControllerTests method testCreateUserWithBadPassword.
@Test
@DatabaseSetup("/data/user/admin-user.xml")
@ExpectedDatabase(value = "/data/user/admin-user.xml", assertionMode = DatabaseAssertionMode.NON_STRICT)
public void testCreateUserWithBadPassword() throws Exception {
CommonUserRegistrationDTO inputDTO = getCommonUserRegistrationDTO(BAD_PASSWORD);
MvcResult mvcResult = mvc.perform(post("/api/v1/auth/registration").contentType(APPLICATION_JSON).content(objectMapper.writeValueAsBytes(inputDTO)).with(anonymous())).andExpect(VALIDATION_ERROR_CODE).andExpect(OK_STATUS).andReturn();
}
use of com.odysseusinc.arachne.commons.api.v1.dto.CommonUserRegistrationDTO in project ArachneCentralAPI by OHDSI.
the class UserControllerTests method getCommonUserRegistrationDTO.
private CommonUserRegistrationDTO getCommonUserRegistrationDTO(String password) {
CommonUserRegistrationDTO inputDTO = new CommonUserRegistrationDTO();
inputDTO.setEmail(EMAIL);
inputDTO.setFirstname(FIRST_NAME);
inputDTO.setLastname(LAST_NAME);
inputDTO.setMiddlename(MIDDLE_NAME);
inputDTO.setPassword(password);
inputDTO.setProfessionalTypeId(PROFESSIONAL_TYPE_ID);
return inputDTO;
}
Aggregations