我有一个数据库,在用户 = '[email protected]' 运行的应用程序脚本中调用时,我需要对所有用户进行读取访问和写入访问
我的 Firebase 结构是
ABC/AAA1/date
ABC/AAA2/date
ABC/AAA3/date
ABC/AAA4/date
规则是:
{
"rules": {
".read": true,
".write": false,
}
}
我如何制定规则以在应用程序脚本中由用户“[email protected]”调用时允许写入。
我使用https://sites.google.com/site/scriptsexamples/new-connectors-to-google-services/firebase/reference插入数据
你应该检查auth
变量。
要定义仅允许通过此电子邮件地址对所有位置进行写访问的安全规则[email protected]
:
{
"rules": {
".read": true,
".write": "auth != null && auth.token.email == '[email protected]'"
}
}
要定义仅允许/users
通过此电子邮件地址对位置进行写访问的安全规则[email protected]
:
{
"rules": {
".read": true,
"users": {
".write": "auth != null && auth.token.email == '[email protected]'"
}
}
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句