.getAdministrationService(getLoggedInUser(sessionId));
List<XGroup> xGroups = new ArrayList<XGroup>();
User forUser = getNativeUser(sessionId, xUser);
if (forUser != null) {
for (Group group : adminService.getGroups(forUser)) {
XGroup xGroup = (XGroup) XConverter.createX(group);
xGroup.clearRoleNames();
for (Role r: group.getRoles()) {
xGroup.addRoleName(r.getName());
}
xGroups.add(xGroup);
}
}
return xGroups.toArray(new XGroup[0]);