Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a new Database per new user in CouchDB without application Tier

Tags:

couchdb

I'm facing the "How to keep private user data private in CouchDB" challenge. Detailed quite well on the couchdb wiki: http://wiki.apache.org/couchdb/PerDocumentAuthorization

I've chosen to make a new database per user, because that's the best fit for the applications I'm creating and because there's a lot of advice from the community to go that route.

I'm having trouble figuring out how to do this. Is there a built in way to do this in CouchDB? So far I have no other need for a middle tier or application tier, and would love to keep this purely a couch + htmll5 application. What is the best case practise for this?

like image 239
Costa Michailidis Avatar asked Oct 09 '22 07:10

Costa Michailidis


1 Answers

A new feature will add support for auto creating/deleting a database per user.

The following section will be added to default.ini and local.ini:

[couch_peruser]
; If enabled, couch_peruser ensures that a private per-user database
; exists for each document in _users. These databases are writable only
; by the corresponding user. Databases are in the following form:
; userdb-{hex encoded username}
enable = true

; If set to true and a user is deleted, the respective database gets
; deleted as well.
delete_dbs = true
like image 109
Tony O'Hagan Avatar answered Oct 12 '22 19:10

Tony O'Hagan