use of org.apache.openmeetings.db.entity.server.SOAPLogin in project openmeetings by apache.
the class SOAPLoginDao method addSOAPLogin.
public String addSOAPLogin(String sessionHash, Long roomId, boolean becomemoderator, boolean showAudioVideoTest, boolean allowSameURLMultipleTimes, Long recordingId, boolean allowRecording) {
try {
SOAPLogin soapLogin = new SOAPLogin();
soapLogin.setCreated(new Date());
soapLogin.setUsed(false);
soapLogin.setRoomId(roomId);
soapLogin.setAllowSameURLMultipleTimes(allowSameURLMultipleTimes);
soapLogin.setHash(UUID.randomUUID().toString());
soapLogin.setRecordingId(recordingId);
soapLogin.setSessionHash(sessionHash);
soapLogin.setModerator(becomemoderator);
soapLogin.setShowAudioVideoTest(showAudioVideoTest);
soapLogin.setAllowRecording(allowRecording);
em.persist(soapLogin);
em.flush();
Long soapLoginId = soapLogin.getId();
if (soapLoginId != null) {
return soapLogin.getHash();
} else {
log.error("[addSOAPLogin]: Could not store SOAPLogin");
}
} catch (Exception ex2) {
log.error("[addSOAPLogin]: ", ex2);
}
return null;
}
use of org.apache.openmeetings.db.entity.server.SOAPLogin 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.SOAPLogin in project openmeetings by apache.
the class RoomPanel method onBeforeRender.
@Override
protected void onBeforeRender() {
super.onBeforeRender();
if (room.isVisible()) {
// We are setting initial rights here
Client c = getClient();
final int count = cm.addToRoom(c.setRoom(getRoom()));
SOAPLogin soap = WebSession.get().getSoapLogin();
if (soap != null && soap.isModerator()) {
c.allow(Right.superModerator);
cm.update(c);
} else {
Set<Right> rr = AuthLevelUtil.getRoomRight(c.getUser(), r, r.isAppointment() ? apptDao.getByRoom(r.getId()) : null, count);
if (!rr.isEmpty()) {
c.allow(rr);
cm.update(c);
}
}
}
}
use of org.apache.openmeetings.db.entity.server.SOAPLogin in project openmeetings by apache.
the class WebSession method setUser.
private void setUser(User u, Set<Right> rights) {
Long _recordingId = recordingId;
Long _roomId = roomId;
Invitation _i = i;
SOAPLogin _soap = soap;
ClientInfo _info = clientInfo;
ExtendedClientProperties _extProps = extProps;
// required to prevent session fixation
replaceSession();
if (_recordingId != null) {
recordingId = _recordingId;
}
if (_roomId != null) {
roomId = _roomId;
}
if (_i != null) {
i = _i;
}
if (_soap != null) {
soap = _soap;
}
if (_info != null) {
clientInfo = _info;
}
if (_extProps != null) {
extProps = _extProps;
}
userId = u.getId();
if (rights == null || rights.isEmpty()) {
Set<Right> r = new HashSet<>(u.getRights());
if (u.getGroupUsers() != null && !AuthLevelUtil.hasAdminLevel(r)) {
for (GroupUser gu : u.getGroupUsers()) {
if (gu.isModerator()) {
r.add(Right.GroupAdmin);
break;
}
}
}
this.rights = Collections.unmodifiableSet(r);
} else {
this.rights = Collections.unmodifiableSet(rights);
}
languageId = u.getLanguageId();
externalType = u.getExternalType();
tz = getTimeZone(u);
ISO8601FORMAT = FastDateFormat.getInstance(ISO8601_FULL_FORMAT_STRING, tz);
setLocale(LocaleHelper.getLocale(u));
sdf = FormatHelper.getDateTimeFormat(u);
}
Aggregations