For each user (username and password) i have a document like this:
{
"_sync": {
"rev": "1-6851cb37477b9077081cdf869a23c255",
"sequence": 3,
"recent_sequences": [
3
],
"history": {
"revs": [
"1-6851cb37477b9077081cdf869a23c255"
],
"parents": [
-1
],
"channels": [
null
]
},
"time_saved": "2016-06-20T16:10:47.5939745+02:00"
},
"courses": [
"AdvancedProgramming",
"SoftwareEngineering"
],
"name": "loris",
"type": "STUDENT"
}
The user must be able to access to this document. So my sync function is like this:
function(doc){
if(doc.type == "STUDENT") {
channel(doc.name)
access(doc.name, doc.name)
}
}
I created the user “loris”, BUT:
curl http://localhost:4985/university-notes/_user/loris
{"name":"loris","all_channels":["!"]}
Note: i created the document before writing the sync_function. If i’ve understood correctly, the sync_function is called only when a document is created/deleted/modified. So probably i have to delete this document and recreate it.