use of cn.opencil.po.RBACUserRole in project CILManagement-Server by LiuinStein.
the class UserController method register.
/**
* Sign up a new member
*/
@RequestMapping(value = "/", method = RequestMethod.POST, produces = { MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE })
@ResponseStatus(HttpStatus.CREATED)
public RestfulResult register(@RequestBody JSONObject input) throws SimpleHttpException, ValidationException {
RBACUser user = ValidationUtils.validate(input.toJavaObject(RBACUser.class), RegisterValidation.class);
UserInfo info = ValidationUtils.validate(input.toJavaObject(UserInfo.class), RegisterValidation.class);
RBACUserRole role = ValidationUtils.validate(input.toJavaObject(RBACUserRole.class), RegisterValidation.class);
if (!userService.addMember(user, info, role)) {
throw new SimpleHttpException(500, "database access error", HttpStatus.INTERNAL_SERVER_ERROR);
}
return new RestfulResult(0, "new member created", new HashMap<>());
}
Aggregations