Reputation: 9464
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?
I tried adding a user as a member of _users
but the same message above appears.
It doesn't look like I can set permissions on specific views according to the documentation (however there is an options
entry I can't find any documentation on).
The above 'forbidden' message isn't in _users/_design/_auth
validate_doc_update
function so it doesn't seem I can edit validate_doc_update
to allow users to view this database.
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
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