Introduction
I am building a firebase web client app. I would like set Firebase Database rules.
- New user registered to a firebase app. Firebase gave him a user.UID.
- Then, admin delete OR disabled the user from firebase admin console.
- User refresh client app.
- (I find out that) user can still write to firebase database even though his account has been deleted/disabled.
.
Goal / Intention
I would like to set a rule that prevent access (.read OR .write) to firebase database when user does not exist OR disabled in admin console/(auth/users).
Some thing like this:
"rules":{
"$uid":{
".write":"auth.isUserActive(auth.uid) == true"
}
}
.
FIREBASE REFERENCE DOC: https://firebase.google.com/docs/reference/security/database/#auth
Question
How can I achieve the above intention? What are the rules should I set to firebase DB?