Umar Farooq Khan
Umar Farooq Khan

Reputation: 11

Restrict firebase database to make new nodes using firebase rules

How can i restrict database to make any new nodes(from an app) in the database using firebase rules.

My database looks like this
enter image description here

Upvotes: 1

Views: 153

Answers (1)

ked
ked

Reputation: 2456

I hope you have wrote rule for all the existing nodes in database, after that write the following rule for preventing creation of new nodes from android app or any other integration

  "rules": {
    "Articles": {
        ".read": //rules that you want to write
        ".write": //rules that you want to write
    }
    "Categories": {
        ".read": //rules that you want to write
        ".write": //rules that you want to write
    }
    .
    .
    //rules for other nodes in your database
    .
    .
    "$NewNode":{
        //This rule will prevent from creating new nodes
        ".read": false,
        ".write": false
    }
  }
}

Upvotes: 1

Related Questions