2

I am very new to the CouchDB world! I have a database that can be read by all users, and also can edit the docs except for the design docs. Is there a way I can make a specific user edit only the doc that was created by him/her. I am using CouchApp nd the jquery.couch.js plugin

swaroopsm
  • 1,389
  • 4
  • 18
  • 34

2 Answers2

3

CouchDB doesn't have per-document permissions, only per-database permissions. If you grant write access to a user, he has write access to all the documents in the database.

rbp
  • 1,850
  • 15
  • 28
  • Just to be thorough, there are server admins as well. They have the ability to access _users, _replicator, delete databases among other things, in addition to anything the lesser admins can do. – fet Feb 22 '13 at 14:47
  • The Achilles heal of CouchDB – iconoclast Dec 17 '21 at 03:31
-1

Assuming you avoid making all users admin and that you use CouchDB's build-in authentication mechanism, I think that's the default behaviour.

For creating regular users, see Creating regular users in CouchDB.

For more details about how the user authentication and authorization actually works, see Security Features Overview, specifically the section below "Authentication database", which outlines the built in rules in CouchDB.

Only admin users can create new users, but there's nothing stopping your from having a program logging in and doing it automatically (using an admin user, this is assuming you are looking for some kind of "Registration" process where you would do for instance email validation through some other software of yours).

Community
  • 1
  • 1
Marius Kjeldahl
  • 6,830
  • 3
  • 33
  • 37
  • I am using couch.js to do all the interaction with my local couchdb. How do I create new user without being logged-in as the admin and restrict access to other users' docs. – swaroopsm Jul 24 '12 at 17:20
  • i don't think this answers the question. couchdb doesn't have per-document permissions. – rbp Feb 15 '13 at 13:25
  • 2
    this is NOT the answer. He was asking about document access, not database access. – Kinesias Mar 11 '17 at 23:15