> On May 5, 2015, at 12:53 PM, atom992 <
yangzi...@gmail.com> wrote:
>
> I want to know that If the user's role "role1" has been removed. what happend on my couchbase Lite with document A? will document A be removed(that what I want to do)?
Almost. It'll update document A to a revision with no properties except for "_removed":true.
> at the same time, I have another question about sync. My sync function based on document A's property P1, If document A have property P1 with the specified value,user B(can be queried by document A) will assign channel1. If document A's property P1 have been removed ,user B should not assign channel1.how should I do to remove channel1 from user B when document A's property P1 have been removed?
I'm not quite sure I understand the question. If the sync function evaluating document A calls access( ) to grant user B access to a channel, and then the next time document A is updated the sync function doesn't grant user B access, then user B will no longer have access to the channel. (Unless there is another document that still gives her access, or her account's admin_channels gives her access, or she has a role that has access.)
Basically, every document in SG has metadata containing a list of user-to-channel grants. That list is rebuild from scratch every time the sync function runs. A user's access is computed by merging together the grants from all current documents.
—Jens