class SoapSecurityService extends AbstractService implements SecurityService {

	@Override
	public WSGroup[] listGroups(String sid) throws Exception {
		checkAdministrator(sid);
		User user = validateSession(sid);

		try {
			List<WSGroup> groups = new ArrayList<WSGroup>();
			GroupDAO dao = (GroupDAO) Context.get().getBean(GroupDAO.class);
			for (Group grp : dao.findAll(user.getTenantId())) {
				if (grp.getType() == Group.TYPE_DEFAULT) {
					dao.initialize(grp);
					groups.add(WSGroup.fromGroup(grp));
				}
			}
			return groups.toArray(new WSGroup[0]);
		} catch (Throwable t) {
			log.error(t.getMessage(), t);
			throw new Exception(t.getMessage());
		}
	}

}