我很难找到在Firebase实时数据库上编写访问规则的正确方法。
我想要做的是:向经过身份验证的用户访问他拥有的公寓以及与这些公寓相关的预订。我的数据模型如下:
{
"clients" : [ {
"email" : "dupont@mail.com",
"flats" : [ 0, 2 ],
"id" : 0,
"name" : "Dupont",
"uid" : "11t1JCNjpLYtwtqddgaFlX9hwSS2"
}, {
"email" : "durand@mail.com",
"flats" : [ 1 ],
"id" : 1,
"name" : "Durand",
"uid" : "nfaET8GgGOSvlA9QEmgIJxX2XH12"
} ],
"flats" : [ {
"id" : 0,
"name" : "3 rooms Paris",
"reservations" : [ 1, 3 ]
}, {
"id" : 1,
"name" : "2 rooms + garden Dubai",
"reservations" : [ 0 ]
}, {
"id" : 2,
"name" : "1 room New York",
"reservations" : [ 2 ]
} ],
"reservations" : [ {
"id" : 0,
"traveler-name" : "Rajesh Gandi"
}, {
"id" : 1,
"traveler-name" : "John Brick"
}, {
"id" : 2,
"traveler-name" : "Romain Dupoussin"
}, {
"id" : 3,
"traveler-name" : "Maleek von de Graaf"
} ]
}
我尝试了许多方法,但似乎都没有用……谢谢您的帮助。