class SoapSecurityService extends AbstractService implements SecurityService {

	@Override
	public void deleteUser(String sid, long userId) throws Exception {
		checkAdministrator(sid);

		if (userId == 1)
			throw new Exception("You cannot delete the admin user");

		try {
			UserDAO dao = (UserDAO) Context.get().getBean(UserDAO.class);
			User usr = dao.findById(userId);
			if (usr.getType() != User.TYPE_DEFAULT) {
				throw new Exception("You cannot delete user with id " + usr.getId() + " because it is a system user");
			}
			dao.delete(userId);
		} catch (Throwable t) {
			log.error(t.getMessage(), t);
			throw new Exception("Unable to delete the user with id " + userId);
		}
	}

}