The Spanish government will grant one-year residency and work permits to potentially 25,000 foreigners affected by the catastrophic flash floods that hit the eastern part of the country last October.