Search in sources :

Example 1 with CommonArachneUserStatusDTO

use of com.odysseusinc.arachne.commons.api.v1.dto.CommonArachneUserStatusDTO in project ArachneCentralAPI by OHDSI.

the class BaseUserController method findUserStatus.

@ApiOperation("Get status of registered user")
@GetMapping(value = "/api/v1/auth/status/{userUuid}")
public JsonResult<CommonArachneUserStatusDTO> findUserStatus(@PathVariable("userUuid") String uuid) throws UserNotFoundException {
    JsonResult<CommonArachneUserStatusDTO> result;
    IUser user = userService.getByUuid(uuid);
    if (user == null) {
        throw new UserNotFoundException("userUuid", "user not found");
    } else {
        result = new JsonResult<>(JsonResult.ErrorCode.NO_ERROR);
        result.setResult(user.getEnabled() ? CommonArachneUserStatusDTO.APPROVED : CommonArachneUserStatusDTO.PENDING);
    }
    return result;
}
Also used : UserNotFoundException(com.odysseusinc.arachne.portal.exception.UserNotFoundException) CommonArachneUserStatusDTO(com.odysseusinc.arachne.commons.api.v1.dto.CommonArachneUserStatusDTO) IUser(com.odysseusinc.arachne.portal.model.IUser) GetMapping(org.springframework.web.bind.annotation.GetMapping) ApiOperation(io.swagger.annotations.ApiOperation)

Aggregations

CommonArachneUserStatusDTO (com.odysseusinc.arachne.commons.api.v1.dto.CommonArachneUserStatusDTO)1 UserNotFoundException (com.odysseusinc.arachne.portal.exception.UserNotFoundException)1 IUser (com.odysseusinc.arachne.portal.model.IUser)1 ApiOperation (io.swagger.annotations.ApiOperation)1 GetMapping (org.springframework.web.bind.annotation.GetMapping)1