> On Jun 2, 2015, at 2:36 AM, Florion COIFFÉ <[email protected]> wrote:
> 
> But where do I get this username ? Should I manually add a user_id property 
> to all my documents and call  access (doc.user_id, "VIP_channel") ?

Something like that, yes. The sync function has no access to any state that 
isn’t part of the document, so it has to get that user ID from the document.

> A user in the local database has a Account table and all the other tables a 
> children of the Account table (not directly, is sub-children etc, it's a 
> tree). I would find it odd to manually add a user_id property to all theses 
> 52 tables since they all are related to a single Account table.

But consider the entire aggregate database in the Sync Gateway. Each document 
should presumably keep track of who its owner is. That’s what that user_id 
property does.

> When my iOS app connects to the sync gateway, It gets back a Session. The 
> session means that the user is granted access to the database. What I would 
> have thought is that each document created during that Session would be 
> automatically associated to the session's user

No, SG does not keep track of who pushed a document to it. In general the 
creator of a document need not be the same as the “owner” of a document. Access 
privileges are generalized enough that SG doesn’t hardcode one specific type of 
access.

—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/EB9AA8D1-5756-448C-91B9-9660538E6A09%40couchbase.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to