class SecurityManagerImpl implements SecurityManager {

	@Override
	public Set<Group> getAllowedGroups(long menuId) {
		Menu menu = menuDAO.findById(menuId);
		if (menu.getSecurityRef() != null)
			menu = menuDAO.findById(menu.getSecurityRef());
		Set<Group> groups = new HashSet<Group>();
		for (MenuGroup mg : menu.getMenuGroups()) {
			Group group = groupDAO.findById(mg.getGroupId());
			if (!groups.contains(group))
				groups.add(groupDAO.findById(mg.getGroupId()));
		}
		Group admin = groupDAO.findById(Group.GROUPID_ADMIN);
		if (!groups.contains(admin))
			groups.add(admin);
		return groups;
	}

	private  SecurityManagerImpl();

}