在firebase中,我可以设置权限只允许对给定对象的PUSH操作? [英] In firebase, can I set permissions to allow only PUSH operations to a given object?

查看:146
本文介绍了在firebase中,我可以设置权限只允许对给定对象的PUSH操作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

标题说明了一切。我想授予权限将新对象推送给给定的列表样式的数据库,但我不想允许完整的写入权限。在这可能吗?

解决方案

不知道什么不允许完全写权限意味着或标题确实说出这一切。但是让我们假设这意味着您希望能够添加记录但不删除或修改它们?做出这些假设,你可以简单地做一个写规则如下:

  //!data.exists():只推一次,不编辑
// newData.exists():不能删除
.write:!data.exists()


The title says it all. I want to grant permissions to push new objects to a given list-style database, but I don't want to allow full write permissions. In this possible?

解决方案

Not sure what "not allow full write permissions" means or that the title does indeed say it all. But let's assume this means you want to be able to add records but not delete or modify them? Making these assumptions, you could simply do a write rule as follows:

// !data.exists(): only push once, no edits
// newData.exists(): cannot delete
".write": "!data.exists()"

这篇关于在firebase中,我可以设置权限只允许对给定对象的PUSH操作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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