From fb30789ed3ae6c23986f98310eb5f0f1173c9e28 Mon Sep 17 00:00:00 2001 From: yugank1991 Date: Tue, 13 Aug 2019 12:54:08 +0530 Subject: [PATCH] updated the firebase rules --- firebase-rules.json | 48 +++++++-------------------------------------- 1 file changed, 7 insertions(+), 41 deletions(-) diff --git a/firebase-rules.json b/firebase-rules.json index bacff0cf0..7f3a9f236 100644 --- a/firebase-rules.json +++ b/firebase-rules.json @@ -1,46 +1,12 @@ { "rules": { - ".read": "auth != null && root.child('users/' + auth.uid + '/roles/admin').val() == true", - ".write": "auth != null && root.child('users/' + auth.uid + '/roles/admin').val() == true", - - "categories": { ".read": true } , - "tagList": { ".read": true } , - "users": { - "$uid": { - ".read": "auth != null && $uid == auth.uid", - "roles": { ".write": false }, - "questions": { ".write": "auth != null && $uid == auth.uid" }, - "games": { ".write": "auth != null && $uid == auth.uid" } - } - }, - "games": { - "$game_id": { - ".read": "auth != null && (data.child('playerIds').child('0').val() == auth.uid || - data.child('playerIds').child('1').val() == auth.uid)", - ".validate": "newData.child('playerIds').child('0').val() === auth.uid", - ".write": "auth != null && ((data.exists() && data.child('gameOver').val() != true && - (data.child('playerIds').child('0').val() == auth.uid || - data.child('playerIds').child('1').val() == auth.uid)) - || - (!data.exists() && - newData.child('playerIds').child('0').val() == auth.uid))" - } - }, - "questions": { - "published": { ".read": true }, - - "unpublished": { - "$question_id": { - ".read": "auth != null && data.child('created_uid').val() == auth.uid", - ".validate": "newData.child('created_uid').val() === auth.uid", - ".write": "auth != null && ((data.exists() && - data.child('created_uid').val() == auth.uid && - data.child('status').val() != 2) - || - (!data.exists() && - newData.child('created_uid').val() == auth.uid))" - } + ".read": "auth != null", + ".write": "auth != null", + "users":{ + "$token_id":{ + ".read": "auth.uid!== null", + ".write": "newData.child('userId').val() === auth.uid" + } } - } } }