4
votes

I want to have a dynamic control on storage rules from database. I mean it should check database nodes to allow read or write. But I cannot find a way. For example

match /files/{fileKey} {
  allow read: // here will check db to get result of allowRead 
  allow write: // here will check db to get result allowWrite
}

db:

files: {
  fileKey1: {
    allowRead: true,
    allowWrite: false
},
  fileKey2: {
    allowRead: true,
    allowWrite: true
}
1

1 Answers

0
votes

There is no way to check the Firebase Database from Firebase Storage security rules.

You'll have to either embed the necessary information into your Storage security rules, or embed it in the user's token as a custom claim.