User created with '!' channel on executing SG config file


#1

Version:
Couchbase Server 4.5.1
SyncGateway 1.4.1

I have started SyncGate Way and Couchbase server service and executed the below sync config file.

{
“databases”: {
“xpense-track”: {
“server”: “http://localhost:8091”,
“bucket”: “test-bucket”,
“users”: {
“GUEST”: {“disabled”: true, “admin_channels”: []},
“myuser”: {“password”: “pass”}
},
“sync”: function (doc, oldDoc) { if(doc && doc.owner){ var channelName = 'channel_'+doc.owner; channel(channelName); access(doc.owner, channelName); } }
}
}
}

Observed channel ‘!’ has been added to the user ‘myuser’ by default once executing the config file.

“all_channels”: [
"!"
]

And on creating new document via curl command for the user ‘myuser’, new channel ‘channel_myuser’ has been created.
-d '{"_id":“uid001”,“owner”:“myuser”, “text”:“test”}
Now the available channels for myuser are ‘!’ and ‘channel_myuser’.

The documentation says, documents added to the channel ‘!’ will be visible to any user, but iam interested only with private channels.

Does it is the SG feature that all users will have public (!) channel by default along with other channels? or can we restrict creating channel ‘!’ by default.


#2

Yes, the public channel is always available. I’m double checking this to be certain, and will edit if I’m wrong, but see the rest of the answer as to why this isn’t needed anyway.

You don’t need to restrict it. Just make sure documents always get assigned to a channel, and they will never be visible on the public channel. Worst case you just create a default alternate channel and assign any docs not explicitly set to another channel to that one.


#3

@hod.greeley, Thank you for the clarification