User getting Invalidated automatically - Please help

24 views
Skip to first unread message

Shiv Veerashetty

unread,
Oct 9, 2015, 11:51:30 AM10/9/15
to Couchbase Mobile
2015-10-09T17:21:11.802+05:30 HTTP:  #078: POST /cwlite/_changes
2015-10-09T17:21:12.176+05:30 HTTP:  #079: POST /cwlite/_revs_diff
2015-10-09T17:21:17.267+05:30 HTTP:  #080: PUT /cwlite/_local/d9e245ab48ca3a8cfb9850e9f3e27de8837caf84
2015-10-09T17:21:31.481+05:30 HTTP:  #081: POST /cwlite/_revs_diff
2015-10-09T17:21:31.558+05:30 HTTP:  #082: POST /cwlite/_bulk_docs
2015/10/09 17:21:31 JS: cust4 
2015/10/09 17:21:31 JS: cust4-ticketOjEIn 
2015/10/09 17:21:31 JS: cust4 
2015-10-09T17:21:31.559+05:30 CRUD: Doc "cust4-ticketOjEIn" in channels "{ticket-cust4-ticketOjEIn}"
2015-10-09T17:21:31.559+05:30 Access: Doc "cust4-ticketOjEIn" grants channel access: map[cust4:ticket-cust4-ticketOjEIn:23]
2015-10-09T17:21:31.559+05:30 CRUD: Stored doc "cust4-ticketOjEIn" / "1-ef8e7598e8d7f1af301e9a4257c346a4"
2015-10-09T17:21:31.559+05:30 Access: Rev "cust4-ticketOjEIn"/"1-ef8e7598e8d7f1af301e9a4257c346a4" invalidates channels of [cust4]
2015-10-09T17:21:31.559+05:30 Access: Invalidate access of "cust4"


Issue is "Access: Invalidate access of "cust4"

I am assigning "cust4" to channel "icket-cust4-ticketOjEIn" and similarly for each of the customers.
But, its showing all the documents to all the logged in customers.


My Sync gateway config is

{
    "log": ["CRUD", "REST+", "Access"],
    "CORS": {
       "Origin":["*"],
       "LoginOrigin":["*"],
       "Headers":["Content-Type"],
       "MaxAge": 1728000
    },
    "adminInterface":":4985",
    "databases": {
        "cwlite": {
             "users": {
         "GUEST": {"disabled": false, "admin_channels": ["*"]}
      },
            "server": "http://192.168.3.134:8091",
                "sync": `
                      function (doc, oldDoc) {
                         if (doc.type == "ticket") {
                             channel("ticket-"+doc._id);
                             var ownerName = doc.owner.substring(doc.owner.indexOf(":") + 1);
                             log(doc.owner);
                             log(doc._id);
                             log(ownerName);
                             access(doc.owner, "ticket-"+doc._id);
                         }
                      }
                      `
                }
        }
}



User Document is (Created this user using admin interface)
-------------------------------------------------------------------------------
{
  "name": "cust4",
  "admin_channels": {
    "cu...@xyz.com": 7
  },
  "all_channels": {
    "!": 1,
    "cu...@xyz.com": 7,
    "ticket-cust4-ticketOjEIn": 23
  },
  "sequence": 7,
  "email": "cu...@xyz.com",
  "passwordhash_bcrypt": "JDJhJDEwJHZuVElOdWpGZC9lUENLSkZ5TzlONGVrdkRXdmw3bFUvNE4yNHhpbmZpaDRvcHFhNzlRQ2Vh",
  "explicit_roles": {
    "customer": 7
  },
  "rolesSince": {
    "customer": 7
  }
}


My expectation is to see user specific documents when replicated in mobile

Please help and let me know if any more information is required.

Thanks & Regards
Shiv

Jens Alfke

unread,
Oct 9, 2015, 12:33:34 PM10/9/15
to mobile-c...@googlegroups.com
I think you also posted this on the Couchbase developer forum. Please don’t post in both places at once.

The answer is that your config file grants guest access to all channels, and your clients are connecting as guest. Take out the “GUEST” user account.

—Jens

Shiv Veerashetty

unread,
Oct 12, 2015, 6:20:08 AM10/12/15
to Couchbase Mobile
Sure Jens, thanks a lot for your help.
I ensure not to duplicate posts.
Reply all
Reply to author
Forward
0 new messages