I am currently developing the Sync Function for my app. In some documents there is a list of usernames that I want to add to a role. This can be easily done using role(username, rolename), but when the document gets updated, it is possible, that a username got removed from the list and therefore the user also needs to be removed from the role. How can I do this in the Sync Function or what workaround would you recommend if this is not possible?
Reposting answer from elsewhere:
Dynamic access grants (performed via the sync function) are associated with the revision of the document performing the grant, and are recomputed each time the document is updated. To revoke a role grant performed by a document, update that document such that the document no longer grants that role.