Daniel
Daniel

Reputation: 9464

List users in CouchDB with member privileges?

In CouchDB, views on the _users database are restricted to admins with the following message:

{
    "error":"forbidden",
    "reason":"Only administrators can view design docs in the users database."
}

What would be the best way for a non-admin user to get a list of users?

Attempted solutions

To give context: I'm creating an application which needs to be aware of all other users with a specific role so that they can interact with each other.

Upvotes: 0

Views: 421

Answers (1)

pixelvip
pixelvip

Reputation: 66

As far as I know there is no possibility to access the _users database without admin privileges. But you might consider writing an server side API to look up your user list. Then access your data via an AJAX call. If you already have an API, that should not be much of an problem. Otherwise you might want to take a look at Express: https://expressjs.com/

Upvotes: 5

Related Questions