因此,我试图将规则设置到存储中,但是我需要访问firestore才能对其进行正确设置。
这是我的示例:
在我的firestore数据库中,我有一个users集合,其中有一个名为的集合items。路径如下所示:/users/items/{itemId}
我希望用户可以使用以下路径将文件读写到存储中:/items/{id}/file.png仅当{id}该项目的已存在于itemsFirestore数据库集合中时。有没有办法使用firestore将规则正确设置到存储中?
我尝试了这个:
service firebase.storage {
match /b/{bucket}/o {
match /items/{item}/{allPaths=**} {
allow read, write: if exists(/databases/{database}/documents/users/$(request.auth.uid)/items/$(item));
}
}
}
Run Code Online (Sandbox Code Playgroud)
但这不起作用:/
谢谢你的帮助!
我在Firebase上创建了一个云功能,我正在尝试对它进行POST方法.我该怎么把这个函数触发到Angular组件?
这是我做的:
const url = 'my-cloud-function-url';
const params: URLSearchParams = new URLSearchParams();
params.set('id', this.id);
this.http.post(url, params)
.toPromise()
.then(res => {
console.log(res);
})
.catch(err => {
console.log(err);
});
Run Code Online (Sandbox Code Playgroud)
所以这段代码正在运行,但POST方法不接受参数中的参数.我知道我可以更改url以在其中添加参数但我很确定这是脏方法.
谢谢你的帮助!