use of org.apache.openmeetings.db.entity.user.Group in project openmeetings by apache.
the class GroupWebService method add.
/**
* add a new group
*
* @param sid
* The SID from getSession
* @param name
* the name of the group
* @return {@link ServiceResult} with result type, and id of the group added
*/
@POST
@Path("/")
public ServiceResult add(@QueryParam("sid") @WebParam(name = "sid") String sid, @QueryParam("name") @WebParam(name = "name") String name) {
log.debug("add:: name {}", name);
return performCall(sid, User.Right.Soap, sd -> {
Group o = new Group();
o.setName(name);
return new ServiceResult(String.valueOf(groupDao.update(o, sd.getUserId()).getId()), Type.SUCCESS);
});
}
use of org.apache.openmeetings.db.entity.user.Group in project openmeetings by apache.
the class TestAddGroup method testAddingGroup.
@Test
public void testAddingGroup() {
Group o = new Group();
o.setName("default");
o = groupDao.update(o, null);
assertNotNull("Id of group created should not be null", o.getId());
User us = userDao.get(1L);
assertNotNull("User should exist", us);
assertNotNull("Group User list should exist", us.getGroupUsers());
us.getGroupUsers().add(new GroupUser(o, us));
us = userDao.update(us, null);
log.error(us.getLastname());
log.error(us.getAddress().getTown());
}
use of org.apache.openmeetings.db.entity.user.Group in project openmeetings by apache.
the class OmTreeProvider method refreshRoots.
public void refreshRoots(boolean all) {
List<BaseFileItem> fRoot = new ArrayList<>(), rRoot = new ArrayList<>();
if (all && roomId != null) {
BaseFileItem r = createRoot(Application.getString("706"), FILES_MY, false);
r.setOwnerId(getUserId());
fRoot.add(r);
}
if (roomId != null) {
BaseFileItem r = createRoot(Application.getString("707"), FILES_ROOM, false);
r.setRoomId(roomId);
fRoot.add(r);
}
if (all) {
{
BaseFileItem r = createRoot(Application.getString("860"), RECORDINGS_MY, true);
r.setOwnerId(getUserId());
rRoot.add(r);
}
{
BaseFileItem r = createRoot(PUBLIC, RECORDINGS_PUBLIC, true);
rRoot.add(r);
}
}
for (GroupUser gu : userDao.get(getUserId()).getGroupUsers()) {
Group g = gu.getGroup();
boolean readOnly = g.isRestricted() && !hasAdminLevel(getRights()) && !gu.isModerator();
if (all) {
BaseFileItem r = createRoot(String.format("%s (%s)", GROUP_REC, g.getName()), String.format(RECORDINGS_GROUP, g.getId()), true);
r.setReadOnly(readOnly);
r.setGroupId(g.getId());
rRoot.add(r);
}
BaseFileItem r = createRoot(String.format("%s (%s)", GROUP_FILE, g.getName()), String.format(FILES_GROUP, g.getId()), false);
r.setGroupId(g.getId());
// group videos are read-only in recordings tree
r.setReadOnly(roomId == null || readOnly);
fRoot.add(r);
}
roots.clear();
if (roomId == null) {
roots.addAll(rRoot);
roots.addAll(fRoot);
} else {
roots.addAll(fRoot);
roots.addAll(rRoot);
}
}
use of org.apache.openmeetings.db.entity.user.Group in project openmeetings by apache.
the class BackupExport method exportGroups.
/*
* ##################### Backup Groups
*/
private void exportGroups(ZipOutputStream zos, ProgressHolder progressHolder) throws Exception {
Registry registry = new Registry();
Strategy strategy = new RegistryStrategy(registry);
Serializer ser = new Persister(strategy);
List<Group> list = groupDao.get(0, Integer.MAX_VALUE);
bindDate(registry, list);
writeList(ser, zos, "organizations.xml", "organisations", list);
progressHolder.setProgress(5);
}
use of org.apache.openmeetings.db.entity.user.Group in project openmeetings by apache.
the class BackupImport method importGroups.
/*
* ##################### Import Groups
*/
private void importGroups(File f, Serializer simpleSerializer) throws Exception {
log.info("Configs import complete, starting group import");
List<Group> list = readList(simpleSerializer, f, "organizations.xml", "organisations", Group.class);
for (Group o : list) {
Long oldId = o.getId();
o.setId(null);
o = groupDao.update(o, null);
groupMap.put(oldId, o.getId());
}
}
Aggregations