Search in sources :

Example 96 with User

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;
    }
}
Also used : User(org.apache.openmeetings.db.entity.user.User) ServiceResult(org.apache.openmeetings.db.dto.basic.ServiceResult) Sessiondata(org.apache.openmeetings.db.entity.server.Sessiondata) OmException(org.apache.openmeetings.util.OmException) OmException(org.apache.openmeetings.util.OmException) ServiceException(org.apache.openmeetings.webservice.error.ServiceException) WebMethod(javax.jws.WebMethod) Path(javax.ws.rs.Path) GET(javax.ws.rs.GET)

Example 97 with User

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());
    });
}
Also used : CalendarPanel(org.apache.openmeetings.web.user.calendar.CalendarPanel) Appointment(org.apache.openmeetings.db.entity.calendar.Appointment) User(org.apache.openmeetings.db.entity.user.User) FormTester(org.apache.wicket.util.tester.FormTester) Menu(com.googlecode.wicket.jquery.ui.widget.menu.Menu) ButtonAjaxBehavior(com.googlecode.wicket.jquery.ui.widget.dialog.ButtonAjaxBehavior) Test(org.junit.Test)

Example 98 with User

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);
}
Also used : User(org.apache.openmeetings.db.entity.user.User) Test(org.junit.Test)

Example 99 with User

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);
}
Also used : User(org.apache.openmeetings.db.entity.user.User) Test(org.junit.Test)

Example 100 with User

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);
    }
}
Also used : Group(org.apache.openmeetings.db.entity.user.Group) GroupUser(org.apache.openmeetings.db.entity.user.GroupUser) User(org.apache.openmeetings.db.entity.user.User) GroupUser(org.apache.openmeetings.db.entity.user.GroupUser) Category(org.junit.experimental.categories.Category) Test(org.junit.Test)

Aggregations

User (org.apache.openmeetings.db.entity.user.User)101 GroupUser (org.apache.openmeetings.db.entity.user.GroupUser)29 Test (org.junit.Test)25 Date (java.util.Date)11 Appointment (org.apache.openmeetings.db.entity.calendar.Appointment)10 ArrayList (java.util.ArrayList)8 ServiceResult (org.apache.openmeetings.db.dto.basic.ServiceResult)8 OmException (org.apache.openmeetings.util.OmException)8 Path (javax.ws.rs.Path)7 MeetingMember (org.apache.openmeetings.db.entity.calendar.MeetingMember)7 Room (org.apache.openmeetings.db.entity.room.Room)7 AbstractJUnitDefaults.getUser (org.apache.openmeetings.AbstractJUnitDefaults.getUser)6 Client (org.apache.openmeetings.db.entity.basic.Client)6 Address (org.apache.openmeetings.db.entity.user.Address)5 Group (org.apache.openmeetings.db.entity.user.Group)5 GroupDao (org.apache.openmeetings.db.dao.user.GroupDao)4 AppointmentDTO (org.apache.openmeetings.db.dto.calendar.AppointmentDTO)4 OAuthUser (org.apache.openmeetings.db.dto.user.OAuthUser)4 Recording (org.apache.openmeetings.db.entity.record.Recording)4 AbstractJUnitDefaults.createUser (org.apache.openmeetings.AbstractJUnitDefaults.createUser)3