Firebase tips(Database rule .1)

3667 단어 Firebase

FIREBASE TIPS


1. Allow users to read everything and write everything.


database.rule.json
{
  "rules": {
    ".read": true,
    ".write": true
  }
}

2. Allow users to read everything and write everything under user object.


database.rule.json
{
  "rules": {
      "user" :{
        ".read": true,
        ".write": true
      }
  }
}

3. Allow users who is certificated to read everything and write under own($uid) object.


database.rule.json
{
  "rules": {
      "user" :{
        "$uid": {
            ".write": "$uid === auth.uid",
            ".read": "auth != null"
        }
      }
  }
}
  • TEST:Read without certification.
  • TEST:Read with certification.
  • TEST:Write with other certification.
  • TEST:Write with certification.
  • 좋은 웹페이지 즐겨찾기