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());
}
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);
}
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() + "'");
}
}
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;
}
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);
}
Aggregations