My application has public documents with a partition key value of “PUBLIC” and private documents for each user using their RealmId as a string for the partition key.
When defining the read sync permissions using the following my understanding was the user would have access to the tables whose _partitionKey
was set to PUBLIC
or equalled the user’s RealmId;
{
"%%partition": [
"PUBLIC",
"%%user.id"
]
}
But when I attempt to open the Realm using;
public static async Task<Realm> GetSyncedRealm(string partition, User realmUser)
{
SyncConfigurationconfig = new SyncConfiguration("PUBLIC", realmUser) { Schema = new[] { typeof(Depot), typeof(PrintGrade) }};
Realm realm = await Realm.GetInstanceAsync(config);
return realm;
}
I get an Operation Canceled
error. If I change the read permissions to true
or;
{
"%%partition": "PUBLIC"
}
I can open the realms for the user including those tables where the partition key is set to the driver’s realm ID; i.e. the _partitionKey
is not “PUBLIC”.
What is the correct syntax to restrict the user’s access to PUBLIC
documents and to those matching their user ID?