Is there a potential race condition with this?
The code is setting temporary properties on the admin instance. Say some ordinary user logs in and wants to view an admin page. The code sets the temporary variables on their FieldLevelPermissionsAdmin so that, for example, they can't change anything.
Simultaneously, a superuser views the page. The code sets their temporary variables on the same FieldLevelPermissionsAdmin, so that they can see and change everything. This happens before the code for the first user gets to choose formfields.
So what happens is that both users will get superuser access - ie both get to see and change all the fields.
It wouldn't happen often, but that just makes it harder to debug.
Or did I miss something?