use of org.apache.openmeetings.db.entity.server.RemoteSessionObject in project openmeetings by apache.
the class WebSession method signIn.
public boolean signIn(String secureHash, boolean markUsed) {
SOAPLogin soapLogin = soapDao.get(secureHash);
if (soapLogin == null) {
return false;
}
if (!soapLogin.isUsed() || soapLogin.getAllowSameURLMultipleTimes()) {
Sessiondata sd = sessionDao.check(soapLogin.getSessionHash());
if (sd.getXml() != null) {
RemoteSessionObject remoteUser = RemoteSessionObject.fromXml(sd.getXml());
if (remoteUser != null && !Strings.isEmpty(remoteUser.getExternalUserId())) {
User user = userDao.getExternalUser(remoteUser.getExternalUserId(), remoteUser.getExternalUserType());
if (user == null) {
user = userDao.getNewUserInstance(null);
user.setFirstname(remoteUser.getFirstname());
user.setLastname(remoteUser.getLastname());
user.setLogin(remoteUser.getUsername());
user.setType(Type.external);
user.setExternalId(remoteUser.getExternalUserId());
user.setExternalType(remoteUser.getExternalUserType());
user.getRights().clear();
user.getRights().add(Right.Room);
user.getAddress().setEmail(remoteUser.getEmail());
user.setPictureuri(remoteUser.getPictureUrl());
} else {
user.setFirstname(remoteUser.getFirstname());
user.setLastname(remoteUser.getLastname());
user.setPictureuri(remoteUser.getPictureUrl());
}
user = userDao.update(user, null);
if (markUsed) {
soapLogin.setUsed(true);
soapLogin.setUseDate(new Date());
soapDao.update(soapLogin);
}
roomId = soapLogin.getRoomId();
sd.setUserId(user.getId());
sd.setRoomId(roomId);
sessionDao.update(sd);
setUser(user, null);
recordingId = soapLogin.getRecordingId();
soap = soapLogin;
return true;
}
}
}
return false;
}
use of org.apache.openmeetings.db.entity.server.RemoteSessionObject in project openmeetings by apache.
the class UserWebService method getRoomHash.
/**
* Description: sets the SessionObject for a certain SID, after setting this
* Session-Object you can use the SID + a RoomId to enter any Room. ...
* Session-Hashs are deleted 15 minutes after the creation if not used.
*
* @param sid
* The SID from getSession
* @param user
* user details to set
* @param options
* room options to set
*
* @return - secure hash or error code
*/
@WebMethod
@POST
@Path("/hash")
public ServiceResult getRoomHash(@WebParam(name = "sid") @QueryParam("sid") String sid, @WebParam(name = "user") @FormParam("user") ExternalUserDTO user, @WebParam(name = "options") @FormParam("options") RoomOptionsDTO options) {
return performCall(sid, User.Right.Soap, sd -> {
RemoteSessionObject remoteSessionObject = new RemoteSessionObject(user.getLogin(), user.getFirstname(), user.getLastname(), user.getProfilePictureUrl(), user.getEmail(), user.getExternalId(), user.getExternalType());
log.debug(remoteSessionObject.toString());
String xmlString = remoteSessionObject.toXml();
log.debug("xmlString " + xmlString);
String hash = soapDao.addSOAPLogin(sid, options.getRoomId(), options.isModerator(), options.isShowAudioVideoTest(), options.isAllowSameURLMultipleTimes(), options.getRecordingId(), options.isAllowRecording());
if (hash != null) {
if (options.isAllowSameURLMultipleTimes()) {
sd.setPermanent(true);
}
sd.setXml(xmlString);
sessionDao.update(sd);
return new ServiceResult(hash, Type.SUCCESS);
}
return UNKNOWN;
});
}
Aggregations