replication - Couchdb apply filter server side -
i'm developing mobile app using pouchdb (client-side) , couchdb (server-side).
i need secure docs in order allow users read/write own documents only.
i did filter this, like:
function(doc, req) { return doc.owner == req.userctx.name || doc.sharedwith == req.userctx.name; } and works well, if request client includes filter:
/somedatabase/_alldocs?filter=filter/secure i need couchdb use filter in every request, or without client explicitation, obvious security reasons. possible? otherwise correct approch handle these security issues?
there similar question here answer not applicable in case since need share docs between users , replicate them between databases not valid option.
so don't know if have looked @ wiki lists few options available. of them outdated tho.
per user database
probably popular solution. said, need share documents other users. done :
- copy document other users when sharing. have deamon listen _changes feed , update author file in other users database.
- build web service access shared documents (very similar proxy solution)
smart proxy
build smart proxy in front of database , business logic fetch documents. gives more control on data flow surely slower.
note
the validate_doc_read server function interest has never been part of couchdb's releases(due listed limitations).
Comments
Post a Comment