Permissions for anonymous users

Hello,

I am building a Realm app and I am wondering if there is a way to grant read-only permissions to anonymously authenticated users, but read & insert permissions to email/password users without any additional data on the document in question?

Yes - you can add this logic to your ‘Apply When’ when configuring Roles. One way to do it is:

  1. Add a Anon Role and add the following ‘Apply When’ expression (since anon users don’t have an email associated with them).

    {
    “%%user.data.email”: { “%exists”: false }
    }

Grant Read only permissions to this Role

  1. Add an Email Password Role and add the following apply when expression

    {
    “%%user.data.email”: { “%exists”: true }
    }

Grant Read and Write permissions to this Role

Roles/Apply When Reference
User Object Reference

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.