use of cz.metacentrum.perun.core.api.exceptions.UserAlreadyRemovedException in project perun by CESNET.
the class UsersManagerImpl method deleteUser.
@Override
public void deleteUser(PerunSession sess, User user) throws UserAlreadyRemovedException, SpecificUserAlreadyRemovedException {
try {
// delete all relations like user -> sponsor -> service
jdbc.update("delete from specific_user_users where specific_user_id=? or user_id=?", user.getId(), user.getId());
int numAffected = jdbc.update("delete from users where id=?", user.getId());
if (numAffected == 0) {
if (user.isSpecificUser())
throw new SpecificUserAlreadyRemovedException("SpecificUser: " + user);
throw new UserAlreadyRemovedException("User: " + user);
}
} catch (RuntimeException err) {
throw new InternalErrorException(err);
}
}
Aggregations