[英]How can I ban a User in Firebase realtime Database using the rules?
我在我的實時數據庫中創建了一個禁止用戶列表,我想讓他們無法登錄,我知道我可以使用數據庫規則,但我不知道怎么做,有人可以幫助我嗎?
這是我的數據庫結構:
/banned-users:
/UserId1:True
/UserId2:True
這些是我的數據庫規則:
{
"rules": {
".read": true,
".write": true
}
}
需要引用其他路徑下的數據,如下:
{
"rules": {
"thepath": {
".read": "root.child('banned-users').child(auth.uid).val() !== true"
".write": "root.child('banned-users').child(auth.uid).val() !== true"
}
}
}
請注意,實際上您並沒有“讓他們無法登錄”,因為這是不可能的,但是您阻止了他們寫入/讀取您的數據庫。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.