From 34930fa6e3dd51b9ea22a9187fdd1075f8c7af16 Mon Sep 17 00:00:00 2001 From: Marshall Polaris Date: Wed, 27 Apr 2022 01:15:28 -0700 Subject: [PATCH] Fix silly bugs in comment rules I made --- firestore.rules | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/firestore.rules b/firestore.rules index e11fd06f..48214e3b 100644 --- a/firestore.rules +++ b/firestore.rules @@ -49,14 +49,14 @@ service cloud.firestore { // it's a bad look if someone can impersonate other ids/names/avatars so check everything let user = get(/databases/$(database)/documents/users/$(userId)); return comment.userId == userId - && comment.userName == user.name - && comment.userUsername == user.username - && comment.userAvatarUrl == user.avatarUrl + && comment.userName == user.data.name + && comment.userUsername == user.data.username + && comment.userAvatarUrl == user.data.avatarUrl; } match /{somePath=**}/comments/{commentId} { allow read; - allow create: if request.auth != null && commentMatchesUser(request.resource.data, request.auth.uid); + allow create: if request.auth != null && commentMatchesUser(request.auth.uid, request.resource.data); } match /{somePath=**}/answers/{answerId} {