In Client(unity), I write document to realm and got permission error because of wrong role.
This is my rule
{
"collection": "player",
"database": "herofishing",
"roles": [
{
"name": "PlayerSelf",
"apply_when": {
"_id": "%%user.id"
},
"document_filters": {
"write": false,
"read": true
},
"fields": {
"deviceUID": {
"write": true,
"read": true
},
"onlineState": {
"write": true,
"read": true
}
},
"additional_fields": {
"write": false,
"read": true
},
"insert": false,
"delete": false,
"search": true
},
{
"name": "OtherPlayer",
"apply_when": {
"%%user.custom_data.role": "OtherPlayer10"
},
"document_filters": {
"write": false,
"read": true
},
"read": true,
"write": false,
"insert": false,
"delete": false,
"search": true
},
{
"name": "Unknown",
"apply_when": {},
"document_filters": {
"write": false,
"read": false
},
"read": false,
"write": false,
"insert": false,
"delete": false,
"search": false
}
]
}