Patrik Ondrovic
Patrik Ondrovic

Reputation: 13

Firebase rule for one property of node

my user database contains all users with data like username, rating, description, email.

I want to access all user but, want to set email to be unreadable. Is it possible to set just one property to not be readable?

this is my rule:

"users": {
      ".indexOn": ["username","id"],
      ".write": false,
      ".read": true, //removed
       "$user_id":{
            "email": {
            ".read": false,
            },
        }
    },

Upvotes: 0

Views: 28

Answers (1)

Frank van Puffelen
Frank van Puffelen

Reputation: 599686

This is not possible with Firebase Realtime Database. Once a user can read a node, they can read all data inside that node.

You'll want to instead separate the emails into their own top-level node, where you then control access on the entire node.

For more on this see:

Upvotes: 0

Related Questions