Thanks for your response.

We changed already the function, as we saw the order of "access" was wrong.

Additionally, we found the primary cause of the slowness of Gateway to be 
the same block.

Now our Sync works really fast!

El martes, 25 de marzo de 2014 12:55:15 UTC-5, Jens Alfke escribió:
>
>
> On Mar 25, 2014, at 8:39 AM, Frederic Yesid Peña Sánchez <
> freder...@gmail.com <javascript:>> wrote: 
>
> > We need to deploy certain documents for all users on "pmsync_todos" 
> channel, and other documents on a per user basis on each "pmsync_USER" 
> channel. 
> > Trying to understand the sync function, how could i authorize 
> "pmsync_todosl" channel for all users? 
>
> One approach is to use server-side code to add it to the user’s 
> admin_channels when you register the account. 
>
> >                 for(var i = 0; i < doc.pmsync_channels.length; i++){ 
> >                         if(doc.pmsync_usuarios) 
> >                                 for(var j = 0; j < 
> doc.pmsync_usuarios.lenght; j++) 
> >                                         
> access(doc.pmsync_channels[i],doc.pmsync_usuarios[j]); 
> >                         if(doc.pmsync_usuario) 
> >                                 access(doc.pmsync_channels[i], 
> doc.pmsync_usuario); 
> >                 } 
>
> You can actually simplify this entire block down to 
>         access(doc.pmsync_channels, doc.pmsync_usuarios); 
> since the ‘access’ function allows either parameter to be an array of 
> strings and will iterate over them. 
>
> > My current approach for enabling access to all users for channel is to 
> create a document for each user, using the "pmsync_todos" channel. 
> > { 
> >         "pmsync_channels”:[“pmsync-todos"], 
> >         "pmsync_usuario”:”pmsync-rafael" 
> > } 
>
> That will work. The app can create such a document on the first launch and 
> then push it to the server. 
>
> Just be aware that this approach allows anyone to give anyone access to 
> any channel, so it doesn’t allow you to use channels for access control. If 
> you need that, you’ll have to add validation to the sync function so 
> documents can’t set up illegal 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 mobile-couchbase+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/951b2e43-2d1f-4411-b0e1-8768d3cb4d2a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to