Madrid earlier this week said it would grant residency and work permits to all foreigners, subject to certain conditions.