6

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
}
Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
Er.Se
  • 461
  • 3
  • 11

2 Answers2

0

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.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
0

This feature is now in alpha and is available for those who opt in for their alpha program - I'll update this answer as soon as it's available for everyone.

One can apply to the alpha program using this link (or google it if the link is no longer working)

vir us
  • 9,920
  • 6
  • 57
  • 66