EU court ruling backs curbs on `benefit tourism`