简体   繁体   English

firebase 实时数据库规则允许多个 uid 进行写访问

[英]firebase realtime database rules to allow multiple uid for write access

I need to allow only 2 specific uid for write access and I can't publish with my current rule:我只需要允许 2 个特定的 uid 进行写访问,我不能用我当前的规则发布:

{
    "rules": {
      ".read": "auth != null",
      ".write": "auth != null && auth.uid === 'abc123' || '123abc'",
    }
}

It keeps complain "rule regulation may not contain '|'它一直抱怨“规则规定可能不包含'|' operator" and "right operand for '||'运算符”和“'||'的右操作数must be boolean", which ever i used.必须是布尔值”,这是我曾经使用过的。 How should I change my rule to achieve what I want?我应该如何改变我的规则来实现我想要的?

Any help will be much appreciated.任何帮助都感激不尽。

The word after || || 之后的词is actually not a boolean, it is just a string.实际上不是 boolean,它只是一个字符串。 Please, check my fixed code.请检查我的固定代码。

{
    "rules": {
      ".read": "auth != null",
      ".write": "auth != null && (auth.uid === 'abc123' || auth.uid === '123abc')",
    }
}

   

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何为特定电子邮件域设置 Firebase 实时数据库安全规则并允许对多个父节点进行读写 - How to set Firebase Realtime Database Security Rules for specific email domain and allow read write to multiple parent nodes 仅允许管理员写入数据 - Firebase 实时数据库 - 安全规则 - Allow only admins to write data - Firebase Realtime Database - Security Rules Firebase实时数据库规则-允许多个用户访问以列出所有消息 - Firebase realtime database rules - Allow multiple user access to list all messages Firebase实时数据库写入规则 - Firebase realtime database write rules Firebase数据库规则UID所有访问权限 - Firebase Database Rules UID All Access $uid 节点如何处理 firebase-realtime-database 规则? - How does $uid node works on firebase-realtime-database rules? 如何允许访问需要身份验证 uid、firebase 数据库规则的字段中的特定字段 - How to allow access to a specific field inside of one that requires auth uid, firebase database rules 如何在 firebase 实时数据库中编写规则? - how to write rules in firebase realtime database? Firebase 实时数据库:Google 警告写入规则 - Firebase Realtime Database: Google warning for write rules 允许在实时 Firebase 数据库中写入一个孩子 - Allow write to one child in Realtime Firebase database
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM