Giving Admin Rights
I'm using Custom Claims to give admin rights to users, by triggering it when a document in "admins/{userId}" is created.
A Cloud Function then sets the "admin" property in the users custom claims to true. Then the user needs login again and he is admin.
Now I check for the admin Custom Claim in the security Rules of Firestore and Storage, so the user can delete/edit everything.
Revoking Admin Rights???
But when I want to revoke the Admin Rights on a user, how do I make sure that the rights are really revoked everywhere.
For the Firestore I can add an additional check, that also gets the data from the Firestore "admins/{userId}" direction and does not allow access.
BUT if I revoke the Rights and the user does not refresh his token, he can still edit/delete everything in the Firestorage. And since I can't access Firestore data from the Storage-Security, I can't even double check the "admins/" direction.
So how do I reliably implement an admin functionality for firestore and storage?