/** Special handling of adding links to the user and domain of the session. */ private void addLinksIncludingUser(Session session) { String domainName = session.getUser().getDomain().getName(); addLinks(session, org.ovirt.engine.api.model.VM.class); session.getUser().setDomain(new Domain()); session.getUser().getDomain().setName(domainName); setSessionUser(session); }
/** * The console user, if exists, is a real ovirt-user. Use its name to get ID and herf information, * and set them inside the user object, inside the session. */ private void setSessionUser(Session session) { User user = getUserResource() .getUserByNameAndDomain( session.getUser().getUserName(), session.getUser().getDomain().getName()); if (user != null) { session.getUser().setId(user.getId()); session.getUser().setHref(user.getHref()); session.getUser().getDomain().setId(user.getDomain().getId()); session.getUser().getDomain().setHref(user.getDomain().getHref()); } }
/** * A session is not a business-entity in the engine and does not have an ID. This method generates * an ID for the session object, based on its attributes. */ private void setSessionId(Session session) { String idString = session.getUser().getName(); if (session.isSetIp() && session.getIp().isSetAddress()) { idString += session.getIp().getAddress(); } if (session.isSetProtocol()) { idString += session.getProtocol(); } session.setId(GuidUtils.generateGuidUsingMd5(idString).toString()); }