[英]How to give access to a list of UID in security rule of firebase realtime database
[英]How to add a Firebase security rule for checking if logged in users email is in a list
我嘗試添加一個安全規則,該規則應授予寫入權限,前提是登錄用戶在記錄中的列表中。
即我的“錦標賽”記錄有一個官員名單,我把那些應該能夠改變錦標賽的人的電子郵件放在那里。
我沒有讓它工作,所以我猜我的規則有一些錯誤。
match /tournaments {
allow read: if request.auth.uid != null;
allow write: if request.auth.token.email in resource.data['officials'];
}
您編寫的規則缺少一些語法。 規則必須如下所述:
match /tournaments/{tournamentID} {
allow read: if request.auth.uid != null;
allow write: if request.auth.token.email in resource.data['officials'];
}
/tournaments/{tournamentID}
表示該規則將適用於錦標賽集合中存在的所有文檔,而{doc_id}
是表示該集合中文檔的通配符。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.