Hello,
I have found multiple articles (most of them about partition and not flexible sync) about how to manage rules according to user groups but I’m not sure about the best practices.
I have a model like this:
I want to allow the user to fetch Object only if he is owner OR in a group attached to the Object (a relationship exist in realm between Object.group and Group because I’m using realm for flutter and the dev mode to build the schema in Atlas)
I tried to define rules like this on Object without success:
{
"$or": [
{"owner": "%%user.id"}, // this one work
{"group.users": "%%user.id"} // this one cause an error
]
}
I tried another thing: the rules is also on the Group Object and works fine like this:
{
"$or": [
{"owner": "%%user.id"},
{"users": "%%user.id"}
]
}
And I try to just put an $exist operator on Object.group at Object rules level. My idea was to check if the $exist is on the resolved relationship or not.
My last try will be to use the user custom data, and add a field group to list all the groups where the user is but I have the feeling this is a bit hackish no ?
Thanks for the help.