在Firestore安全规则中,可以在另一个自定义功能中使用自定义功能吗?

发布于 2025-01-26 18:53:34 字数 740 浏览 2 评论 0原文

在Firestore安全规则中,我正在编写一个自定义函数(IseEtherNotSecreTorIsowner()),其中还有另一个自定义函数(allystorequestor()),但是官方的Google Firebase文档在自定义功能上似乎是沉默的好的。

代码摘录以下:

function belongsToRequestor() {
return request.auth.uid == resource.data.userId
}

function isEitherNotSecretOrIsOwner() {
resource.data.reviewPrivacy != 'keepSecret' ||
belongsToRequestor()
}

我希望这没关系,因为我需要将iSeEthernOtseCretorIsowner()放入一组更长的&&&条件中,而我是我的条件不确定如何在&&条件的字符串中拥有“ x || y”。

感谢您的任何帮助!

In Firestore security rules, I'm writing a custom function (isEitherNotSecretOrIsOwner()), with another custom function (belongsToRequestor()) inside of it, but the official Google Firebase documentation on custom functions seems to be silent on whether this is okay or not.

Code excerpt below:

function belongsToRequestor() {
return request.auth.uid == resource.data.userId
}

function isEitherNotSecretOrIsOwner() {
resource.data.reviewPrivacy != 'keepSecret' ||
belongsToRequestor()
}

I hope this is okay, because I need to put the isEitherNotSecretOrIsOwner() inside a longer set of && conditions and I'm not sure how else to have the "either X || Y" inside a string of && conditions…

Thanks for any help!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

ぺ禁宫浮华殁 2025-02-02 18:53:34

只要您所调用的功能在呼叫站点的范围中,就确实支持了来自另一个自定义功能的一个自定义功能。

Calling one custom functions from within another one is indeed supported in Firestore security rules, as long as the function you're calling is in scope at the call site.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文