我正在使用这种方法来吸引用户
getUsers(userUid): Promise<void|Users> {
return this.firestore
.collection(this.collectionName)
.doc(userUid)
.ref
.get()
.then(
res => res.data() as Users
).catch(
err => this.handleErr(err)
);
}
安全规则为:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /users/{userId} {
allow read, write: if request.auth.uid == userId;
}
}
}
访问文档ID与userUID相同的文档时权限不足