use of org.apache.openmeetings.web.app.WebSession in project openmeetings by apache.
the class AbstractWicketTester method login.
public void login(String login, String password) {
WebSession s = WebSession.get();
try {
if (login != null && password != null) {
s.signIn(login, password, Type.user, null);
} else {
s.signIn(adminUsername, userpass, Type.user, null);
}
} catch (OmException e) {
fail(e.getMessage());
}
assertTrue("Web session is not signed in for user: " + (login != null ? login : adminUsername), s.isSignedIn());
}
use of org.apache.openmeetings.web.app.WebSession in project openmeetings by apache.
the class RoomResourceReference method getFileItem.
@Override
protected FileItem getFileItem(Attributes attr) {
PageParameters params = attr.getParameters();
StringValue _id = params.get("id");
String uid = params.get("uid").toString();
Long id = null;
try {
id = _id.toOptionalLong();
} catch (NumberFormatException e) {
// no-op expected
}
WebSession ws = WebSession.get();
Client c = cm.get(uid);
if (id == null || !ws.isSignedIn() || c == null) {
return null;
}
FileItem f = (FileItem) fileDao.getAny(id);
if (f == null) {
return null;
}
String ruid = params.get("ruid").toString();
String wuid = params.get("wuid").toString();
if (c.getRoom() != null) {
Whiteboards wbs = wbManager.get(c.getRoom().getId());
if (!Strings.isEmpty(wuid) && !Strings.isEmpty(ruid) && ruid.equals(wbs.getUid())) {
for (Entry<Long, Whiteboard> e : wbs.getWhiteboards().entrySet()) {
JSONObject file = e.getValue().get(wuid);
if (file != null && f.getId().equals(file.optLong(ATTR_FILE_ID))) {
// item IS on WB
return f;
}
}
}
}
if (f.getGroupId() != null && groupUserDao.isUserInGroup(f.getGroupId(), getUserId())) {
return f;
}
return null;
}
use of org.apache.openmeetings.web.app.WebSession in project openmeetings by apache.
the class TestUserService method hashTest.
@Test
public void hashTest() throws OmException {
ServiceResult r = login();
ServiceResult r1 = getHash(r.getMessage(), false);
assertEquals("OM Call should be successful", Type.SUCCESS.name(), r1.getType());
// to ensure WebSession is attached
ensureApplication(-1L);
WebSession ws = WebSession.get();
assertTrue(ws.signIn(adminUsername, userpass, User.Type.user, null));
Long userId0 = WebSession.getUserId();
ws.checkHashes(StringValue.valueOf(r1.getMessage()), StringValue.valueOf(""));
assertTrue("Login via secure hash should be successful", ws.isSignedIn());
Long userId1 = WebSession.getUserId();
Assert.assertNotEquals(userId0, userId1);
}
use of org.apache.openmeetings.web.app.WebSession in project openmeetings by apache.
the class TestLoginUI method checkLogin.
private void checkLogin(String login, String pass) {
FormTester formTester = tester.newFormTester("signin:signin");
formTester.setValue("login", login);
formTester.setValue("pass", pass);
formTester.submit("submit");
tester.assertNoErrorMessage();
tester.assertRenderedPage(MainPage.class);
WebSession ws = (WebSession) tester.getSession();
assertTrue("Login should be successful", ws.isSignedIn());
}
Aggregations