Using Futon to manage CouchDB users is fairly straightforward. There’s a few caveats when adding a new user or adding roles to a user or changing a user’s password. So, I set out to create a CouchApp to help manage users through a basic interface. The source is available on GitHub.
Introduction
The CouchDB User Manger app is a single HTML file attached to a CouchDB document. I created a document called “user_admin” in a database called “loveseat” and attached the HTML file there. The URL to the app is http://127.0.0.1:5984/loveseat/user_admin/users.html. For testing purposes, I left this document open to the public. However, in a production environment a document validation function should be used to prevent the public from modifying the attachment and roles should be assigned to allow read-only access to the database.
Aside from attaching the HTML file to a document, there is one other changes required in CouchDB. A design view is required to “emit” user information to the application.
Designing a View
In order to prevent unnecessary access to data in the _users database, I created a view that only reveals the following user details: _id, _rev, roles and name. The view also does not transmit details regarding the user “admin.”
function(doc) {
var key;
if(doc.name != “admin”){
key = [doc._id, doc._rev, doc.roles];
emit(key, doc.name);}}
Here is what the view looks like in Futon.

About the App
After the attachment and the listForSelect view is in place, you should be able to access the CouchApp. The page logs out the current user each time it is loaded. So, even if you are logged into CouchDB when you access the page, you will be logged out and prompted to log in.

After logging into the app, the create, update and delete interface is presented. The select lists are dynamically refreshed when a new user is added or delete via the tool. Updates do not refresh the select options. In the update section, roles are populated based on the user selected.

Summary
There’s still some work to be done. Specifically, improved error handling and alerting the user to session timeout before data is submitted.
Check out the source on github and let me know if you have any questions or suggestions.
Link to source on github: https://github.com/markfennell/couchDBUsersManager