use of org.eclipse.che.api.user.server.model.impl.UserImpl in project che by eclipse.
the class UserDaoTest method shouldThrowConflictExceptionWhenUpdatingUserWithReservedEmail.
@Test(expectedExceptions = ConflictException.class)
public void shouldThrowConflictExceptionWhenUpdatingUserWithReservedEmail() throws Exception {
final UserImpl user = users[0];
user.setEmail(users[1].getEmail());
userDao.update(user);
}
use of org.eclipse.che.api.user.server.model.impl.UserImpl in project che by eclipse.
the class UserDaoTest method shouldRemoveUser.
@Test(expectedExceptions = NotFoundException.class, dependsOnMethods = "shouldThrowNotFoundExceptionWhenGettingNonExistingUserById")
public void shouldRemoveUser() throws Exception {
final UserImpl user = users[0];
userDao.remove(user.getId());
userDao.getById(user.getId());
}
use of org.eclipse.che.api.user.server.model.impl.UserImpl in project che by eclipse.
the class UserService method updatePassword.
@POST
@Path("/password")
@Consumes(APPLICATION_FORM_URLENCODED)
@GenerateLink(rel = LINK_REL_CURRENT_USER_PASSWORD)
@ApiOperation(value = "Update password of logged in user", notes = "Password must contain at least 8 characters, " + "passport must contain letters and digits")
@ApiResponses({ @ApiResponse(code = 204, message = "Password successfully updated"), @ApiResponse(code = 400, message = "Incoming password is invalid value." + "Valid password must contain at least 8 character " + "which are letters and digits"), @ApiResponse(code = 500, message = "Couldn't update password due to internal server error") })
public void updatePassword(@ApiParam(value = "New password", required = true) @FormParam("password") String password) throws NotFoundException, BadRequestException, ServerException, ConflictException {
userValidator.checkPassword(password);
final UserImpl user = new UserImpl(userManager.getById(userId()));
user.setPassword(password);
userManager.update(user);
}
use of org.eclipse.che.api.user.server.model.impl.UserImpl in project che by eclipse.
the class JpaUserDao method doCreate.
@Transactional(rollbackOn = { RuntimeException.class, ApiException.class })
protected void doCreate(UserImpl user) throws ConflictException, ServerException {
EntityManager manage = managerProvider.get();
manage.persist(user);
manage.flush();
eventService.publish(new PostUserPersistedEvent(new UserImpl(user))).propagateException();
}
use of org.eclipse.che.api.user.server.model.impl.UserImpl in project che by eclipse.
the class JpaUserDao method remove.
@Override
public void remove(String id) throws ServerException {
requireNonNull(id, "Required non-null id");
try {
Optional<UserImpl> userOpt = doRemove(id);
userOpt.ifPresent(user -> eventService.publish(new UserRemovedEvent(user.getId())));
} catch (RuntimeException x) {
throw new ServerException(x.getLocalizedMessage(), x);
}
}
Aggregations