Search in sources :

Example 11 with GroupUser

use of org.apache.openmeetings.db.entity.user.GroupUser in project openmeetings by apache.

the class TestUserContact method createUserWithGroup.

@Test
public void createUserWithGroup() throws Exception {
    String uuid = UUID.randomUUID().toString();
    User u = getUser(uuid);
    u.getGroupUsers().add(new GroupUser(groupDao.get(1L), u));
    u = userDao.update(u, null);
    assertTrue("Password should be set as expected", userDao.verifyPassword(u.getId(), createPass()));
    User u1 = userDao.get(u.getId());
    assertNotNull("Just created user should not be null", u1);
    assertNotNull("Just created user should have non null org-users", u1.getGroupUsers());
    assertFalse("Just created user should have not empty org-users", u1.getGroupUsers().isEmpty());
}
Also used : GroupUser(org.apache.openmeetings.db.entity.user.GroupUser) User(org.apache.openmeetings.db.entity.user.User) GroupUser(org.apache.openmeetings.db.entity.user.GroupUser) Test(org.junit.Test)

Example 12 with GroupUser

use of org.apache.openmeetings.db.entity.user.GroupUser in project openmeetings by apache.

the class TestUserGroup method getUsersByGroupId.

@Test
public void getUsersByGroupId() {
    User u = getValidUser();
    Long groupId = u.getGroupUsers().get(0).getGroup().getId();
    List<GroupUser> ul = groupUserDao.get(groupId, 0, 9999);
    assertTrue("Default Group should contain at least 1 user: " + ul.size(), ul.size() > 0);
    GroupUser ou = groupUserDao.getByGroupAndUser(groupId, u.getId());
    assertNotNull("Unable to find [group, user] pair - [" + groupId + "," + u.getId() + "]", ou);
}
Also used : GroupUser(org.apache.openmeetings.db.entity.user.GroupUser) User(org.apache.openmeetings.db.entity.user.User) GroupUser(org.apache.openmeetings.db.entity.user.GroupUser) Test(org.junit.Test)

Example 13 with GroupUser

use of org.apache.openmeetings.db.entity.user.GroupUser in project openmeetings by apache.

the class TestUserGroupAggregation method testitNow.

@Test
public void testitNow() {
    User u = userDao.get(1L);
    assertNotNull("Group list for default user must not be null", u.getGroupUsers());
    assertTrue("Default user must belong to at least one group", u.getGroupUsers().size() > 0);
    for (GroupUser orgUserObj : u.getGroupUsers()) {
        log.error("testitNow: group Id: '" + orgUserObj.getGroup().getId() + "'; name: '" + orgUserObj.getGroup().getName() + "'");
    }
}
Also used : User(org.apache.openmeetings.db.entity.user.User) GroupUser(org.apache.openmeetings.db.entity.user.GroupUser) GroupUser(org.apache.openmeetings.db.entity.user.GroupUser) Test(org.junit.Test)

Example 14 with GroupUser

use of org.apache.openmeetings.db.entity.user.GroupUser in project openmeetings by apache.

the class InviteUserToRoomDialog method getPrivateRooms.

private List<Room> getPrivateRooms(Long userId1, Long userId2, RoomDao roomDao) {
    List<Long> orgIds = new ArrayList<>();
    List<Long> orgIds2 = new ArrayList<>();
    for (GroupUser gu : userDao.get(userId1).getGroupUsers()) {
        orgIds.add(gu.getGroup().getId());
    }
    for (GroupUser gu : userDao.get(userId2).getGroupUsers()) {
        orgIds2.add(gu.getGroup().getId());
    }
    orgIds.retainAll(orgIds2);
    List<Room> result = new ArrayList<>();
    for (Long orgId : orgIds) {
        result.addAll(roomDao.getGroupRooms(orgId));
    }
    return result;
}
Also used : GroupUser(org.apache.openmeetings.db.entity.user.GroupUser) ArrayList(java.util.ArrayList) Room(org.apache.openmeetings.db.entity.room.Room)

Example 15 with GroupUser

use of org.apache.openmeetings.db.entity.user.GroupUser in project openmeetings by apache.

the class ImportInitvalues method createSystemUser.

public User createSystemUser(User u, String group, String login, String pass, boolean groupAdmin) throws Exception {
    GroupUser gu = new GroupUser(groupDao.get(group), u);
    gu.setModerator(groupAdmin);
    u.getGroupUsers().add(gu);
    u.setLogin(login);
    return userDao.update(u, pass, null);
}
Also used : GroupUser(org.apache.openmeetings.db.entity.user.GroupUser)

Aggregations

GroupUser (org.apache.openmeetings.db.entity.user.GroupUser)28 User (org.apache.openmeetings.db.entity.user.User)19 Group (org.apache.openmeetings.db.entity.user.Group)9 Test (org.junit.Test)7 ServiceResult (org.apache.openmeetings.db.dto.basic.ServiceResult)5 Date (java.util.Date)4 ArrayList (java.util.ArrayList)3 HashSet (java.util.HashSet)3 Path (javax.ws.rs.Path)3 AbstractJUnitDefaults.createUser (org.apache.openmeetings.AbstractJUnitDefaults.createUser)3 AbstractJUnitDefaults.getUser (org.apache.openmeetings.AbstractJUnitDefaults.getUser)3 GroupDao (org.apache.openmeetings.db.dao.user.GroupDao)3 Appointment (org.apache.openmeetings.db.entity.calendar.Appointment)3 RoomGroup (org.apache.openmeetings.db.entity.room.RoomGroup)3 JSONObject (com.github.openjson.JSONObject)2 AppointmentDTO (org.apache.openmeetings.db.dto.calendar.AppointmentDTO)2 OAuthUser (org.apache.openmeetings.db.dto.user.OAuthUser)2 MeetingMember (org.apache.openmeetings.db.entity.calendar.MeetingMember)2 BaseFileItem (org.apache.openmeetings.db.entity.file.BaseFileItem)2 JSONArray (com.github.openjson.JSONArray)1