Firebase Rules for a Chat feature -


in project have chat feature allow users speak in private message. it's one-to-one, improved later allow group discussion.

currently i'm struggling custom rules. indeed, projet need users have theirs own list of discussion. example, user , b talk through private message, user c, d or whatever shouldn't able read discussion.

here how database json :

{ "room-messages": {     "-kwgoxt567vzgxz-1gii": {         "-kwgoxt567vzgxz-1gii": {             "name": "friendly chat",             "sent": 1479294463723,             "text": "nice ! have created new chat",             "uid": "user_a_id"         },         "-kwh5_w12qsxfajhyovx": {             "name": "lucien guimaraes",             "sent": 1479294463728,             "text": "a text message",             "uid": "user_b_id"         }     },     "-kwgoxt567vzgxz-1git": {         "-kwgoxt567vzgxz-1git": {             "name": "friendly chat",             "sent": 1479294463723,             "text": "nice ! have created new chat (2)",             "uid": "user_a_id"         },         "-kwh5_w12qsxfajhyovz": {             "name": "lucien guimaraes",             "sent": 1479294463729,             "text": "test",             "uid": "user_c_id"         }     } }, "room-metadata": {     "-kwgoxt567vzgxz-1gii": {         "users": {             "user_a_id": "lucien guimaraes",             "user_b_id": "geralt of rivia"         }     },     "-kwgoxt567vzgxz-1git": {         "users": {             "user_a_id": "lucien guimaraes",             "user_c_id": " gordon freeman"         }     } } } 

for information "user_a_id" or "user_b_id" should id provided firebase authentication. in example want user rooms (because he's in both available room). user b should have first room , user b last room.

here rules :

firebase rules project

i have been able allow write access rooms (the remaining issue user can't delete message, don't know why). read have huge issue : can't set custom rule because value "$roomid" unknown inside "room-messages". it's possible child of "$roomid".

is there solution want implemented ?

thanks !

#askfirebase


Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -