"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "openmeetings-web/src/main/java/org/apache/openmeetings/web/app/Application.java" between
apache-openmeetings-6.1.0-src.tar.gz and apache-openmeetings-6.2.0-src.tar.gz

About: OpenMeetings is a browser-based software that allows you to set up instantly a conference in the Web. You can use your microphone or webcam, share documents on a white board, share your screen or record meetings. Source code.

Application.java  (apache-openmeetings-6.1.0-src):Application.java  (apache-openmeetings-6.2.0-src)
skipping to change at line 44 skipping to change at line 44
import static org.wicketstuff.dashboard.DashboardContextInitializer.DASHBOARD_CO NTEXT_KEY; import static org.wicketstuff.dashboard.DashboardContextInitializer.DASHBOARD_CO NTEXT_KEY;
import java.io.File; import java.io.File;
import java.net.UnknownHostException; import java.net.UnknownHostException;
import java.text.MessageFormat; import java.text.MessageFormat;
import java.util.HashSet; import java.util.HashSet;
import java.util.Locale; import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
import javax.websocket.WebSocketContainer; import javax.websocket.WebSocketContainer;
import org.apache.openmeetings.IApplication; import org.apache.openmeetings.IApplication;
import org.apache.openmeetings.core.sip.SipManager; import org.apache.openmeetings.core.sip.SipManager;
import org.apache.openmeetings.core.util.ChatWebSocketHelper; import org.apache.openmeetings.core.util.ChatWebSocketHelper;
import org.apache.openmeetings.core.util.WebSocketHelper; import org.apache.openmeetings.core.util.WebSocketHelper;
import org.apache.openmeetings.db.dao.basic.ConfigurationDao; import org.apache.openmeetings.db.dao.basic.ConfigurationDao;
import org.apache.openmeetings.db.dao.calendar.AppointmentDao; import org.apache.openmeetings.db.dao.calendar.AppointmentDao;
import org.apache.openmeetings.db.dao.label.LabelDao; import org.apache.openmeetings.db.dao.label.LabelDao;
import org.apache.openmeetings.db.dao.record.RecordingDao; import org.apache.openmeetings.db.dao.record.RecordingDao;
import org.apache.openmeetings.db.dao.user.UserDao; import org.apache.openmeetings.db.dao.user.UserDao;
import org.apache.openmeetings.db.entity.basic.Client; import org.apache.openmeetings.db.entity.basic.Client;
import org.apache.openmeetings.db.entity.calendar.Appointment; import org.apache.openmeetings.db.entity.calendar.Appointment;
import org.apache.openmeetings.db.entity.calendar.MeetingMember; import org.apache.openmeetings.db.entity.calendar.MeetingMember;
import org.apache.openmeetings.db.entity.record.Recording; import org.apache.openmeetings.db.entity.record.Recording;
import org.apache.openmeetings.db.entity.room.Invitation; import org.apache.openmeetings.db.entity.room.Invitation;
import org.apache.openmeetings.db.entity.room.Room; import org.apache.openmeetings.db.entity.room.Room;
import org.apache.openmeetings.db.entity.room.RoomGroup; import org.apache.openmeetings.db.entity.room.RoomGroup;
import org.apache.openmeetings.db.entity.user.Group;
import org.apache.openmeetings.db.entity.user.GroupUser; import org.apache.openmeetings.db.entity.user.GroupUser;
import org.apache.openmeetings.db.entity.user.User; import org.apache.openmeetings.db.entity.user.User;
import org.apache.openmeetings.db.entity.user.User.Type; import org.apache.openmeetings.db.entity.user.User.Type;
import org.apache.openmeetings.db.util.ApplicationHelper; import org.apache.openmeetings.db.util.ApplicationHelper;
import org.apache.openmeetings.db.util.ws.RoomMessage; import org.apache.openmeetings.db.util.ws.RoomMessage;
import org.apache.openmeetings.db.util.ws.TextRoomMessage; import org.apache.openmeetings.db.util.ws.TextRoomMessage;
import org.apache.openmeetings.util.OmFileHelper; import org.apache.openmeetings.util.OmFileHelper;
import org.apache.openmeetings.util.Version; import org.apache.openmeetings.util.Version;
import org.apache.openmeetings.util.ws.IClusterWsMessage; import org.apache.openmeetings.util.ws.IClusterWsMessage;
import org.apache.openmeetings.web.common.PingResourceReference; import org.apache.openmeetings.web.common.PingResourceReference;
skipping to change at line 524 skipping to change at line 526
public String urlForActivatePage(PageParameters pp) { public String urlForActivatePage(PageParameters pp) {
return urlForPage(ActivatePage.class, pp, null); return urlForPage(ActivatePage.class, pp, null);
} }
//END hack for email templates support (should be in separate module for now //END hack for email templates support (should be in separate module for now
public static String getInvitationLink(Invitation i, String baseUrl) { public static String getInvitationLink(Invitation i, String baseUrl) {
String link = ""; String link = "";
Room r = i.getRoom(); Room r = i.getRoom();
User u = i.getInvitee(); User u = i.getInvitee();
if (r != null) { if (r != null) {
if (r.isAppointment() && i.getInvitedBy().getId().equals( if ((i.isPasswordProtected() && !r.isOwner(u.getId())) //
u.getId())) { invitation is password-protected and invitee is not owner
link = getRoomUrlFragment(r.getId()).getLink(); || Type.CONTACT == u.getType() || Type.EX
} else { TERNAL == u.getType() || !get().isRoomAllowedToUser(r, u)) // no-access
boolean allowed = Type.CONTACT != u.getType() && {
Type.EXTERNAL != u.getType(); PageParameters pp = new PageParameters();
if (allowed) { pp.add(INVITATION_HASH, i.getHash());
allowed = get().isRoomAllowedToUser(r, u) if (u.getLanguageId() > 0) {
; pp.add("language", u.getLanguageId());
}
if (allowed) {
link = getRoomUrlFragment(r.getId()).getL
ink();
} else {
PageParameters pp = new PageParameters();
pp.add(INVITATION_HASH, i.getHash());
if (u.getLanguageId() > 0) {
pp.add("language", u.getLanguageI
d());
}
link = urlForPage(HashPage.class, pp, bas
eUrl);
} }
link = urlForPage(HashPage.class, pp, baseUrl);
} else {
link = getRoomUrlFragment(r.getId()).getLink();
} }
} }
Recording rec = i.getRecording(); Recording rec = i.getRecording();
if (rec != null) { if (rec != null) {
link = urlForPage(HashPage.class, new PageParameters().ad d(INVITATION_HASH, i.getHash()), baseUrl); link = urlForPage(HashPage.class, new PageParameters().ad d(INVITATION_HASH, i.getHash()), baseUrl);
} }
return link; return link;
} }
private static boolean checkAppointment(Appointment a, User u) { private static boolean checkAppointment(Appointment a, User u) {
if (a == null || a.isDeleted()) { if (a == null || a.isDeleted()) {
return false; return false;
} }
if (a.getOwner().getId().equals(u.getId())) { if (a.isOwner(u.getId())) {
log.debug("[isRoomAllowedToUser] appointed room, Owner en tered"); log.debug("[isRoomAllowedToUser] appointed room, Owner en tered");
return true; return true;
} }
for (MeetingMember mm : a.getMeetingMembers()) { return a.getMeetingMembers().stream()
if (mm.getUser().getId().equals(u.getId())) { .map(MeetingMember::getUser)
return true; .map(User::getId)
} .anyMatch(userId -> userId.equals(u.getId()));
}
return false;
} }
private static boolean checkGroups(Room r, User u) { private static boolean checkGroups(Room r, User u) {
if (null == r.getGroups()) { //u.getGroupUsers() can't be null du e to user was able to login if (null == r.getGroups()) { //u.getGroupUsers() can't be null du e to user was able to login
return false; return false;
} }
for (RoomGroup ro : r.getGroups()) { Set<Long> roomGroups = r.getGroups().stream()
for (GroupUser ou : u.getGroupUsers()) { .map(RoomGroup::getGroup)
if (ro.getGroup().getId().equals(ou.getGroup().ge .map(Group::getId)
tId())) { .collect(Collectors.toSet());
return true; return u.getGroupUsers().stream()
} .map(GroupUser::getGroup)
} .map(Group::getId)
} .anyMatch(roomGroups::contains);
return false;
} }
public boolean isRoomAllowedToUser(Room r, User u) { public boolean isRoomAllowedToUser(Room r, User u) {
if (r == null) { if (r == null) {
return false; return false;
} }
if (r.isAppointment()) { if (r.isAppointment()) {
Appointment a = appointmentDao.getByRoom(r.getId()); Appointment a = appointmentDao.getByRoom(r.getId());
return checkAppointment(a, u); return checkAppointment(a, u);
} else {
if (r.getIspublic() || (r.getOwnerId() != null && r.getOw
nerId().equals(u.getId()))) {
log.debug("[isRoomAllowedToUser] public ? {} , ow
nedId ? {} ALLOWED", r.getIspublic(), r.getOwnerId());
return true;
}
return checkGroups(r, u);
} }
if (r.getIspublic() || r.isOwner(u.getId())) {
log.debug("[isRoomAllowedToUser] public ? {} , ownedId ?
{} ALLOWED", r.getIspublic(), r.getOwnerId());
return true;
}
return checkGroups(r, u);
} }
public static boolean isUrlValid(String url) { public static boolean isUrlValid(String url) {
return new UrlValidator(new String[] {"http", "https"}).isValid(u rl); return new UrlValidator(new String[] {"http", "https"}).isValid(u rl);
} }
public static String urlForPage(Class<? extends Page> clazz, PageParamete rs pp, String inBaseUrl) { public static String urlForPage(Class<? extends Page> clazz, PageParamete rs pp, String inBaseUrl) {
RequestCycle rc = RequestCycle.get(); RequestCycle rc = RequestCycle.get();
String baseUrl = isUrlValid(inBaseUrl) ? inBaseUrl String baseUrl = isUrlValid(inBaseUrl) ? inBaseUrl
: (isUrlValid(getBaseUrl()) ? getBaseUrl() : ""); : (isUrlValid(getBaseUrl()) ? getBaseUrl() : "");
 End of changes. 9 change blocks. 
46 lines changed or deleted 33 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)