if (!CollectionUtils.isEmpty(user.getRoles())) {
for (Iterator<? extends Role> it = user.getRoles().iterator(); it.hasNext();) {
Role role = it.next();
if (!roles.contains(role)) {
it.remove();
role.removeMember(user);
}
}
}
dao.updateUser(user);
if (!CollectionUtils.isEmpty(user.getRoles()))