class SecurityServiceImpl extends RemoteServiceServlet implements SecurityService {

	@Override
	public void addUserToGroup(long groupId, long userId) throws ServerException {
		ServiceUtil.checkMenu(getThreadLocalRequest(), Menu.SECURITY);
		Session session = ServiceUtil.checkMenu(getThreadLocalRequest(), Menu.SECURITY);

		UserDAO userDao = (UserDAO) Context.get().getBean(UserDAO.class);
		GroupDAO groupDao = (GroupDAO) Context.get().getBean(GroupDAO.class);
		User user = userDao.findById(userId, true);
		user.addGroup(groupDao.findById(groupId));
		try {
			userDao.store(user);
			userDao.initialize(user);
		} catch (Throwable t) {
			ServiceUtil.throwServerException(session, log, t);
		}
	}

}