【发布时间】:2019-03-31 05:02:54
【问题描述】:
当我打开 Firebase 存储桶并转到文件时,我的文件夹结构如下:
/<environment>/reports/<userId>/
我希望只允许经过身份验证的userId 读取、写入该用户文件夹中的报告。
我尝试了以下操作,但它给了我访问被拒绝的消息。我究竟做错了什么?我几乎一对一地复制了 docs 中的示例。
// Grants a user access to a node matching their user ID
service firebase.storage {
match /b/{bucket}/o {
// Files look like: "<ENVIRONMENT>/reports/<UID>/path/to/file.txt"
match /production/reports/{userId}/{allPaths=**} {
allow read, write: if request.auth.uid == userId;
}
}
}
【问题讨论】: