firebase - 是否可以在子目录中使用通配符变量?
问题描述
我一直在为我的 ionic 应用程序制定安全规则,我一直想知道通配符是否可以用作规则中子级的附加目录。
这是我目前拒绝访问错误的规则
"rules": {
"Download": {
"$id": {
".read":"root.child('password/'+$id).child('password').val() === 4321"
}
}
}
虽然这是我使用正在工作的完整子目录的规则
"rules": {
"Download": {
"$id": {
".read":"root.child('password/12342').child('password').val() === 4321"
}
}
}
这个,是下载节点
Download: {
4123: {
id: 01
user:john
}
3123: {
id: 01
user:john
}
}
密码节点
password: {
12342: {
password: 4321
id: 01
}
}
这个是接收函数,
let qwee = await new Promise(function(resolve,reject){
return firebaseRef.child('QuizDownload/3123')
.on("child_added", function(snapshot) {
//console.log(snapshot.val());
//data.push(snapshot.val());
// data
console.log(snapshot.val());
//resolve(data);
//container.push(snapshot.val());
}, function(err) {
console.log(err);
reject(err);
})
});
}
您能否建议使用通配符作为目录的附加错误应该是什么?
解决方案
推荐阅读
- swift - 什么时候显示“您想将此密码保存在您的 iCloud 钥匙串中”的提示吗?
- python - 在Python中采样大于p的n个随机素数的最快方法?
- ios - 无法理解符号化的崩溃报告
- python - 如何让 DJANGO 在网页上获取我的 dht11 或 mlx90614 红外读取传感器值?
- python - Python:如何创建孩子必须使用的方法
- java - 如何每小时调用一次这种改造方法?
- python - Django 表单 IntegerField 值验证
- azure - 如何为所有 Azure 资源创建自定义标记策略(需要“ProjectName”标记)
- angular - 错误:NG0302:找不到管道“翻译”!导入另一个组件时
- database - postgresql 按列将数据导入数据库