Sync Gateway remove access

Hello,

In Sync Gateway, It’s possible to remove the access permission to channels that previously has been added by access (“user”, “channel”); ?

Thanks.

1 Like

I have the same question.

A new revision of the doc that previously granted access can reverse that permission.

For example - if you’re granting access based on an ‘owner’ property in the document, with something like this in your sync function:

if (doc.owner) {
  access(doc.owner, 'somechannel')
}

A new revision of the document that modifies the owner property will mean this document no longer grants the previous doc.owner access to somechannel.

Hi,

Does removing the document have the same effect ?

Regards.

If a document is deleted through the SG API, it will generate a deleted (tombstone) revision, which works in a similar fashion.