Sync Gateway Replication not restricting by channel

52 views
Skip to first unread message

Johnathan Grayson

unread,
Nov 29, 2014, 4:38:12 PM11/29/14
to mobile-c...@googlegroups.com
Ok so I'm sure I'm doing something wrong but for the life of me I can see what. I've been at this for several hours now.

I have created a simple demo app for iOS and configured Sync Gateway on my local network. Login is via facebook and seems to work. I see users created, when I add documents my sync function is creating the channels. BUT, for some reason every user is able to see every document. The last example I tried was logging in a new user on an empty database, so by default they don't have access to any channels (I can see this by viewing their _user: document). If they then create a document and put it in a channel (sync function) in theory at least if I wipe the phone and log them in again that document should not be replicated back to their phone right? This is the post box scenario.

I can't see anyone else reporting a similar issue so I know I'm doing something stupid, any help gratefully appreciated.

Thanks in advance.

---

The iOS code is on a public git repo so I can share it here https://github.com/ajgrayson/CouchbaseDemo, nothing special about it.



Oh and the user document "_sync:user:ypsslsl_pandit...@tfbnw.net" looks like,

{
  "all_channels": {},
  "sequence": 0,
  "passwordhash_bcrypt": "JDJhJDEwJE1nNnB3QkxRd081T2pyZXlabGxVZE83ZlBpdVlpak9ROHUvYVlBQWtGa3FManptT1hqcG1L",
  "rolesSince": {}
}

and the document "C419BC4A-9ECC-4757-9D97-8F972B8D7559" they created looks like,

{
  "_sync": {
    "rev": "1-e8212b751869c1df19df7b3b19c5d27e",
    "sequence": 2,
    "history": {
      "revs": [
        "1-e8212b751869c1df19df7b3b19c5d27e"
      ],
      "parents": [
        -1
      ],
      "bodies": [
        ""
      ],
      "channels": [
        [
        ]
      ]
    },
    "channels": {
    },
    "time_saved": "2014-11-30T10:16:53.771858451+13:00"
  },
  "category": "none",
  "title": "test-01",
  "type": "item"
}

ajres

unread,
Dec 1, 2014, 11:30:52 AM12/1/14
to mobile-c...@googlegroups.com
In your demo App, change AppDelegate.swift

from

private let kServerUrl = "http://192.168.1.6:4985/default/"

to

private let kServerUrl = "http://192.168.1.6:4984/default/"

4985 is the Admin port, so no authentication applies there, usually this port would not be exposed to mobile clients.

Andy

Johnathan Grayson

unread,
Dec 1, 2014, 11:47:28 PM12/1/14
to mobile-c...@googlegroups.com
Thanks for the quick response Andy! It worked a treat.
Reply all
Reply to author
Forward
0 new messages