> On Feb 20, 2015, at 8:33 PM, Seung Chan Lim <[email protected]> wrote:
> 
> But for some reason doing 2) and 3) is very fuzzy for me... Could someone 
> help me better understand this? Something invisible and implicit is confusing 
> me.

Maybe it’ll help to explain what’s going on behind the scenes.

Internally, every document stores a couple of pieces of metadata:
        - the set of channels it’s in
        - a set of (user, channel) pairs, each of which declares that a user 
gets access to a channel
        - a set of (role, channel) pairs with similar meanings.
All of that metadata is produced by the callbacks invoked by the sync function. 
And it’s updated every time the doc is updated.

The way a user’s access privileges are computed is to start with the 
‘admin_channels’ property, i.e. the channels the user is specifically given 
access to, and then add in all of the channels granted by documents — all the 
channels in (user, channel) pairs where the user matches. (A role’s access 
privileges are computed the same way.) Finally all the channels accessible to 
all the users’ roles are added.

So basically, user/role X has access to channel C if any of these is true:
        - channel C is in X's admin_channels property
        - there is some document that declares a (X, C) pair
        - X is a user and has a role R such that R has access to C by the rules 
above

Does that help?

—Jens

-- 
You received this message because you are subscribed to the Google Groups 
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/C8B8EBB0-EBC2-44A3-A41E-2CD4FED8182B%40couchbase.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to