Serverside - CouchDB only
Couple days ago, I stumbled to CouchDB. I liked it immediately, one of the reason 开发者_如何学Pythonwas because it's REST! So, next day, I was thinking about security. I saw there is /_session, for authentication.
But still, there is one major thing I'm thinking about, and that's filtering requests and data. So, lets say /users/ gets list of all users. If ROLE is ADMIN, then it should get all data, but if ROLE is something else, then lets say it should only send username and email, but not other data. Is this possible with CouchDB?
Thanks!
Yes, it is possible to do this. List and Show functions have access to information about the user's request, so if they are authenticated as an Administrator you can change the output of the request.
See:
- http://guide.couchdb.org/draft/transforming.html#arguments
- http://wiki.apache.org/couchdb/Formatting_with_Show_and_List
- http://blog.couchone.com/post/1027100082/whats-new-in-couchdb-1-0-part-4-securityn-stuff
精彩评论