Every now and then when we restore production databases in development environment we get a few emails from developers complaining about that they are unable to do something or just cant log in to the database. Those that we remember to give permissions to are happier but those we forget or just are left out just aren't happy. I don't blame them because there is a hole in our process.
I was wondering if there is a script that can help me extract all the permissions from an existing database in development environment, whether the permissions are at the object level (table, view) or whether at the role level (dbo, db_reader etc.) so every time after the restore from Prod I can just run this script of permissions and keep everyone happy.