Realm Sync: Restrict partitionKey values for users

Hi there,
I’m looking into the Realm partitionKey configuration but I could not find where to specify the rules to map users to allowed partionKeys.

A node that wants to start a Realm synchronization, needs a user authentication key and a partitionKey. I need to restrict the allowed values for the partitionKey only to certain values. The best would be being able to write a custom function that, provided the realm user Id and partition key, return a boolean to know if the value is allowed.
Alternatively, I would like to add a list of allowed partitionKey values on user creation, stored in the realm custom user data and allow the sync only if the partitionKey is among those values.

Is it possible to have such configuration?

1 Like


I wrote a Medium article on partitions and permissions, maybe this will help.

Richard Krueger