rules_version = '2';
firebase.storage {
match /b/{bucket}/o {
match /Users/{userId} {
allow read: if request.auth != null;
allow write : if itemDelete(userId);
}
function itemDelete(userId){
return userId != '1.jpg' || '2.jpg' ;
}
}
}
How can I use OR || operator in firebase security rules if I use userId != ‘1.jpg’ this works but when I use userId != ‘1.jpg’ || ‘2.jpg’ this not work.
Please help me
2
Answers
From the doc:
In your case it means that
itemDelete(userId)
should return aboolean
.But with
it is not the case.
It’s not clear to me what is the exact logic of the current code of the
itemDelete()
function so I let you adapt it in such a way it returns aboolean
in line with your security requirements.What you’re trying to do is actually an AND condition and expressed like this: