The best way to do this is to script out the users and their permissions while the test databases are in a good state.
Then:
1. restore from PROD
2. drop all prod users in the databases
3. create all the test users in the databases and grant them their permissions