I'm new to this as well. Though to control access to a document, there is a
sample project to refer to: https://github.com/couchbaselabs/ToDoLite-iOS.
It give each doc a property: memebers, it is an array where all users that
has access would be set in this array.
Then each time sync function is processing the doc, channel access is given
to these user within the array. The code below.
if (Array.isArray(doc.members)) {
var memberNames = [];
for (var i = doc.members.length - 1; i >= 0; i--) {
memberNames.push(doc.members[i].substring(doc.members[i].indexOf(":"
)+1))
};
access(memberNames, "list-"+doc._id); //"list-"+doc._id is the
channel name
}
I've not yet been using roles yet, so lets count on the others.
-Sean
On Saturday, February 21, 2015 at 12:33:46 PM UTC+8, Seung Chan Lim wrote:
>
> I think I still lack a more fundamental understanding of what's going on
> with the sync function. The part that's confusing me is what's happening
> _implicitly_.
>
> If I understand correctly. Each time a document is created/updated the
> sync function is called.
>
> From what I understand, there is an _implicit_ connection between a call
> to "access," "role," or "channel" and the document being created/updated.
>
> Now...
>
> If I want to remove a user's access to a document. I have 3 choices:
> 1) Stop routing the document to a channel that the usr has access to.
> 2) Remove the user's access to the channel that the document is routed to.
> 3) Remove the user from the role that has access to the channel the
> document is routed to
>
> To do 1) I simply don't call "channel" when a new revision of the doc is
> passed to the sync function. While the old revision may have been
> accessible to the user, the new revision will not be. That part is clear.
>
> 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.
>
> slim
>
--
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/7529da5a-90dd-4346-9232-a0d2934703ec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.