@MobDev

There are a number of features available to you in the sync function that 
can restrict who can create and modify documents e.g for the following doc 
format.

{"_id": "ACA9083F",

 "owner": "alice",

 "readers": ["bob",…],

 "category": "riddle",

 "text": "Why is a…"

}


You might use these in your sync function


*"Every document must have an owner."*

if (!doc.owner)

*    throw({forbidden:* "Missing owner"});


*"The owner property must be immutable."*

if (oldDoc && doc.owner != oldDoc.owner)

    *throw({forbidden:* "Owner changed"});


*"The owner is the user who is creating the document."*

*requireUser*(doc.owner);


*"Only those with the 'creator' role can create documents."*

*requireRole*("creators");



-- 
You received this message because you are subscribed to the Google Groups 
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/ec48acd7-7108-4f01-a04b-65106b17fe90%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to