I am struggling to set up permission for realm flexible sync. I have four Realms. Two Realms sync only on the “userId”. The other two Realms sync if the “userIid” matches or the “sync” field is set to PUBLIC.
{
"rules": {},
"defaultRoles": [
{
"name": "admin",
"applyWhen": {
"%%user.custom_data.isAdmin": true
},
"read": true,
"write": true
},
{
"name": "user",
"applyWhen": {},
"read": {
"$or": [
{
"userId": "%%user.id"
},
{
"sync": "PUBLIC"
}
]
},
"write": {
"userId": "%%user.id"
}
}
]
}
This permission set causes errors since most of the collections don’t have the “sync” field. What is the best way to set up permission for this and are there any good guides out available? I haven’t found many useful docs or guides.