Here mine CSG conf:
"vm3" : {
"server": "http://127.0.0.1:8091",
"bucket":"vm3",
"revs_limit": 5,
...
"sync":`function(doc, oldDoc){
var chan=null;
if (doc.type=='fruit') {
chan = doc._id.replace(/:/g, '');
}
requireAccess(chan);
access(doc.members,chan);
channel(chan);
}`
}
I have 2 type of user:
- admin(A) with channel ["*"]
- other(O) with channel []
When A save a doc, he puts on doc.member the name of a user:
{
doc._id : 1
doc._rev: 1
doc.member : ["user1"]
doc.type : "fruit"
}
When A save again the doc 1 removing the member:
{
doc._id : 1
doc._rev: 2
doc.member : []
doc.type : "fruit"
}
user1 doesn’t get the any changes but on his client he still to see the first doc(rev1). Until Here everythings works fine.
But when user1 retry to save the doc1 whit rev1 he doesn’t get 403 like aspected from requireAccess(chan) validation.
Where is my fault?
–
Is it possible to use console.log() on CSG conf. How i can setup the log section?
–
On the documentation page i read about requireChannels() function but it doesn’t exist.