Complete the code to allow anyone to read data.
{
"rules": {
".read": [1]
}
}Setting .read to true allows anyone to read the data.
Complete the code to allow only authenticated users to write data.
{
"rules": {
".write": [1]
}
}Using auth != null ensures only signed-in users can write data.
Fix the error in the rule to allow authenticated users to read and write.
{
"rules": {
".read": [1],
".write": [1]
}
}Both .read and .write should be set to auth != null to allow only authenticated users.
Fill both blanks to allow authenticated users to read, but only users with matching UID to write.
{
"rules": {
".read": [1],
".write": [2]
}
}Read is allowed for any authenticated user (auth != null), but write is allowed only if the user's UID matches (auth.uid == $uid).
Fill all three blanks to allow anyone to read, only authenticated users to write, and only if the data has a 'public' field set to true.
{
"rules": {
".read": [1],
".write": [2],
"data": {
".validate": "newData.hasChild('public') && newData.child('public').val() == [3]"
}
}
}Read is open to all (true), write requires authentication (auth != null), and the 'public' field must be true (true).
