.remove()方法的Firebase安全规则 [英] Firebase Security Rules for .remove () method

查看:60
本文介绍了.remove()方法的Firebase安全规则的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的数据上限制.remove()方法-仅允许作者/创建者具有.remove节点的能力.这可能吗?

I want to restrict .remove() method on my data - only allowing the author/creator the ability to .remove the node. Is this possible?

我有标准用户树和一对数据树geoFire和一个命名细节.详细信息"的节点包含时间戳记和用户(与auth.uid匹配)之类的条目.

I have the standard users tree and a pair of data trees geoFire and one named details. 'Details' has nodes that contain entries like timestamp and user (which matches auth.uid).

推荐答案

Firebase中的删除意味着您正在将无/空数据写入当前包含数据的位置:

A remove in Firebase means that you're writing no/empty data to a location that currently contains data:

".write": "!data.exists() || newData.exists()"

确保我拥有所有这些的快速表格:

Quick table to ensure I got all of them:

data.     newData.
exists()  exists()  .write
--------+---------+--------
false     false     true
false     true      true
true      false     false
true      true      true

这篇关于.remove()方法的Firebase安全规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆