How to have both restriction and permission in the Cloudfire Store

Asked

Viewed 32 times

2

I’m using firebase as a database, specifically the cloudFire store database. I have a field called comment, which I want to be read by all users at the same time, but only the administrator can delete it. However, when I add the delete rule, read stops working. It follows the structure I’m using (edited for the topic):

    rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {
    match /avaliacoes/{document=**} {

      allow read, create: if true;
    }
    match /block/{document=**} {

      allow read, update, delete, create: if request.auth.uid == 'uid_do_admin'; //parte editada para o topico
    }
    match /comentarios/{document=**} {

      allow create: if true;
      allow read: if true;
      allow update: if true;
      allow delete: if request.auth.uid == 'id_do_administrador'; // editado para o tópico
    }

    match /empresas/{document=**} {

      allow read, create: if true;
    }
    match /favoritos/{document=**} {

      allow read, create: if true;
    }
    match /users/{document=**} {

      allow read, create: if true;
    }
  }
}
  • What is the result of the test report for these rules?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.