![](/img/trans.png)
[英]How to give access to a list of UID in security rule of firebase realtime database
[英]how to write a firebase Realtime database rule to match root folder child folders name with New Data custom uid
我想要 go 給一些用戶特殊權限,如果他們有自定義 UID,可以寫入像 (Sp_Adim) 這樣的文件夾。 授予權限所有保存在實時數據庫文件夾中的自定義 UID 我如何檢查這個
"Newdata.child('S_uid').val === root.child(\"$folder\")"
我試過它不工作,即使文件夾在里面 Cust_uid/sdsd 被拒絕
root.child('Cust_uid').child(\"$custom_id\").exists() === 'sdsd'
我究竟做錯了什么?
看起來您將通配符捕獲變量放在引號中,這是不正確的。
如果您的規則樹中有一個$custom_id
變量,您可以在特定規則中使用它:
root.child('Cust_uid').child(custom_id).exists()
如果要檢查該根下節點的值,請確保也將.val
調用到路徑的末尾。 所以:
newdata.child('S_uid').val === root.child($folder).val()
最后,請注意大小寫很重要,所以它是newData
而不是NewData
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.