wild card channel

35 views
Skip to first unread message

Seung Chan Lim

unread,
Mar 17, 2015, 6:36:26 PM3/17/15
to mobile-c...@googlegroups.com
In my sync function I call:

channel("*")

on a document, and I'm expecting now any authenticated user to be able to see the content of this document. But I'm proven wrong by reality.

I get forbidden to my request.

When I look at the metadata I see this:

"_sync": {
       "rev": "1-1c42b022e1ce1aebba7cb6acbe80f463",
       "sequence": 196,
       "history": {
           "revs": [
               "1-1c42b022e1ce1aebba7cb6acbe80f463"
           ],
           "parents": [
               -1
           ],
           "bodies": [
               ""
           ],
           "channels": [
               [
                   "*"
               ]
           ]
       },
       "channels": {
           "*": null
       },
       "access": {
           "c2c6671de7b6442aacd21c84383aaffe": {
               "c2c6671de7b6442aacd21c84383aaffe": 196
           }
       },
       "time_saved": "2015-03-17T21:16:07.687450231Z"
   },

What am I doing wrong?

Adam Fraser

unread,
Mar 17, 2015, 8:13:31 PM3/17/15
to mobile-c...@googlegroups.com
The "*" channel doesn't make documents public (viewable to everyone).  It's the reverse scenario - users who have been granted access to the "*" channel can view all documents.  You don't need to explicitly add documents to the "*" channel - all documents are automatically added.

In Sync Gateway release 1.0.4 we've added support for a public channel (the "!" channel), which sounds like what you're looking for.  If a document is added to the "!" channel, it's available to all users.

Thanks,
Adam

Seung Chan Lim

unread,
Mar 17, 2015, 8:35:34 PM3/17/15
to mobile-c...@googlegroups.com
Got it. I now understand that when I give a user access to the "*" channel, that user has access to all document (i.e. giving GUEST access to "*" channel would, in most cases, be a bad idea, for example. ) Am I understanding right?

Yes, "!" is exactly what I'm looking for. When's 1.0.4 due out?

slim

Jens Alfke

unread,
Mar 17, 2015, 9:13:59 PM3/17/15
to mobile-c...@googlegroups.com

On Mar 17, 2015, at 5:35 PM, Seung Chan Lim <djs...@gmail.com> wrote:

Yes, "!" is exactly what I'm looking for. When's 1.0.4 due out?

Good question. It’s been code-frozen for several months but there have been logistical issues holding up releasing it. Each of our main Github repositories has a “v1.0.4” branch that you can check out and build.

—Jens
Reply all
Reply to author
Forward
0 new messages