use of org.apache.openmeetings.db.entity.user.User in project openmeetings by apache.
the class UserWebService method login.
/**
* @param user - login or email of Openmeetings user with admin or SOAP-rights
* @param pass - password
*
* @return - {@link ServiceResult} with error code or SID and userId
*/
@WebMethod
@GET
@Path("/login")
public ServiceResult login(@WebParam(name = "user") @QueryParam("user") String user, @WebParam(name = "pass") @QueryParam("pass") String pass) {
try {
log.debug("Login user");
User u = userDao.login(user, pass);
if (u == null) {
return new ServiceResult("error.bad.credentials", Type.ERROR);
}
Sessiondata sd = sessionDao.create(u.getId(), u.getLanguageId());
log.debug("Login user: {}", u.getId());
return new ServiceResult(sd.getSessionId(), Type.SUCCESS);
} catch (OmException oe) {
return oe.getKey() == null ? UNKNOWN : new ServiceResult(oe.getKey(), Type.ERROR);
} catch (Exception err) {
log.error("[login]", err);
return UNKNOWN;
}
}
use of org.apache.openmeetings.db.entity.user.User in project openmeetings by apache.
the class TestCalendar method testEventCreate.
@Test
public void testEventCreate() throws OmException {
testArea(regularUsername, p -> {
Menu menu = (Menu) p.get(PATH_MENU);
Assert.assertNotNull(menu);
tester.getRequest().setParameter("hash", menu.getItemList().get(0).getItems().get(1).getId());
tester.executeBehavior((AbstractAjaxBehavior) menu.getBehaviorById(0));
tester.assertComponent(PATH_CHILD, CalendarPanel.class);
CalendarPanel cal = (CalendarPanel) p.get(PATH_CHILD);
tester.executeAllTimerBehaviors(cal);
User u = userDao.getByLogin(regularUsername, User.Type.user, null);
// test create month
tester.getRequest().setParameter("allDay", String.valueOf(false));
tester.getRequest().setParameter("startDate", LocalDateTime.of(2017, 11, 13, 13, 13).toString());
tester.getRequest().setParameter("endDate", LocalDateTime.of(2017, 11, 13, 13, 13).toString());
tester.getRequest().setParameter("viewName", CalendarView.month.name());
// select-event
tester.executeBehavior((AbstractAjaxBehavior) cal.get("form:calendar").getBehaviorById(0));
FormTester appTester = tester.newFormTester(PATH_APPOINTMENT_DLG_FRM);
// check inviteeType:groupContainer:groups is invisible for regular user
String title = String.format("title%s", UUID.randomUUID());
appTester.setValue("title", title);
ButtonAjaxBehavior save = getButtonBehavior(PATH_APPOINTMENT_DLG, "save");
tester.executeBehavior(save);
List<Appointment> appts = appointmentDao.searchByTitle(u.getId(), title);
assertEquals("Appointment should be created", 1, appts.size());
assertEquals("Appointment should be created", title, appts.get(0).getTitle());
});
}
use of org.apache.openmeetings.db.entity.user.User in project openmeetings by apache.
the class TestUserCount method testCountSearchUsers.
@Test
public void testCountSearchUsers() throws Exception {
User u = createUser();
assertTrue("Account of search users should be one", userDao.count(u.getFirstname()) == 1);
}
use of org.apache.openmeetings.db.entity.user.User in project openmeetings by apache.
the class TestUserCount method testCountFilteredUsers.
@Test
public void testCountFilteredUsers() throws Exception {
User u = createUser();
User contact = createUserContact(u.getId());
assertTrue("Account of filtered user should be one", userDao.count(contact.getFirstname(), true, u.getId()) == 1);
}
use of org.apache.openmeetings.db.entity.user.User in project openmeetings by apache.
the class TestUserGroup method add10kUsers.
@Test
@Category(HeavyTests.class)
public void add10kUsers() throws Exception {
List<Group> groups = groupDao.get(GROUP_NAME, 0, 1, null);
Group g = null;
if (groups == null || groups.isEmpty()) {
g = new Group();
g.setName(GROUP_NAME);
g = groupDao.update(g, null);
} else {
g = groups.get(0);
}
for (int i = 0; i < 10000; ++i) {
User u = createUser();
u.getGroupUsers().add(new GroupUser(g, u));
userDao.update(u, null);
}
}
Aggregations