0

How is a user removed from a channel when the user was granted access via sync function?

As I understand it adding a document to a channel operates on the document revision. It is therefore easy to remove a document from a channel (or remove a channel from a document? I suppose there is a single right way of phrasing this) as each update of a document sets the document's channel to nil and the sync function can decide further what to do.

Would granting a user access to a channel via access() do the same? I read the following here, which suggests it does:

When a document is updated and either the previous or the current revision grants channel access, all of the users and roles named in both revisions' access lists have their all_channels properties cleared to nil to invalidate them.

In which case it operates similar to document channel assignment.

J. Reynolds
  • 151
  • 3
  • 14

1 Answers1

0

So here is the answer from the documentation:

Sync Function API

The sync function is called every time a new revision/update is made to a document, and the changes to channels and access made by the sync function are tied to that revision. If the document is later updated, the sync function will be called again on the new revision, and the new channel assignments and user/channel access replace the ones from the first call.

Emphasis mine.

J. Reynolds
  • 151
  • 3
  • 14