我在Firebase中为节点添加了一些自定义属性。就像;
{
"user" : {
"UID11" : {
"address" : "address of user 1",
"siteLink" : "site1",
"subSiteLink" : "subsite1",
},
"UID12" : {
"address" : "address of user 2",
"siteLink" : "site1"
"subSiteLink" : "subsite2",
}
"UID21" : {
"address" : "address of user 2",
"siteLink" : "site2"
"subSiteLink" : "subsite2",
}
}
}
并且,有站点节点。就像;
{
"site1" : {
"subsite1" : {
"someproperty" : "somevalue",
"someproperty2" : "someValue"
},
"subsite2" : {
"someproperty" : "somevalue",
"someproperty2" : "someValue"
},
"general1" : {
"someproperty" : "somevalue",
"someproperty2" : "someValue"
},
"general2" : {
"someproperty" : "somevalue",
"someproperty2" : "someValue"
}
}
"site2" : {
"subsite1" : {
"someproperty" : "somevalue",
"someproperty2" : "someValue"
},
"subsite2" : {
"someproperty" : "somevalue",
"someproperty2" : "someValue"
},
"general1" : {
"someproperty" : "somevalue",
"someproperty2" : "someValue"
},
"general2" : {
"someproperty" : "somevalue",
"someproperty2" : "someValue"
}
}
}
现在,我想创建一些规则。用户只能访问自己的子站点,并且只能访问用户有权访问的站点中的常规*节点。以下是根据上述信息的示例;
UID11 可以访问 site1.subsite1,site1.general1,site1.general2 。
UID12 可以访问 site1.subsite2,site1.general1,site1.general2 。
UID21 可以访问 site2.subsite1,site2.general1,site2.general2 。
如何创建这些规则?