service cloud.firestore {
  match /databases/{database}/documents {
    match /{document=**} {
      allow read: if true;
      allow write: if false;
    }
    match /authors/{userId} {
      allow read: if request.auth.uid == userId;
      allow write: if false;
    }
    match /categories/{anyDocument} {
      allow read: if true;
      allow write: if false;
    }
    match /posts/{anyDocument} {
      allow read: if true;
      allow write: if exists(/databases/$(database)/documents/authors/$(request.auth.uid));
    }
  }
}
