HospitalRun/hospitalrun-frontend

Users module doesn't work with CouchDB 2.0

jkleinsc opened this issue · 11 comments

Expected behavior:
All functionality of the Users module should work with CouchDB 2.0
Actual behavior:
When a user who has admin rights navigates to the users module, they are redirected to login.
Steps to reproduce:
Setup HospitalRun to use CouchDB 2.0
Navigate to the Users module
Screenshots (if applicable):
N/A
OS and Browser:
All

The issue seems to be caused by this line in the documentation: Only administrators may browse list of all documents (GET /_users/_all_docs) which is clearly not the case in CouchDB 1.6.

The admin/users route makes an API call to fetch all users in the database: https://github.com/HospitalRun/hospitalrun-frontend/blob/master/app/adapters/user.js#L170. Since the currently logged-in user is not a CouchDB administrator, the call returns a 401 error response, which in turn logs the user out.

In 2.0, Only administrator accounts can successfully make such calls. I do not see any way to authenticate login using the administrator credentials since they are stored in the config file, and not in the _users database.

@adeolabadmus the 1.6 documentation says the same thing. I am talking to Jan Lehnardt of CouchDB about the issue. He thinks it is something they missed porting over.

I think I'm hitting this bug / issue even though I used CouchDB 1.6 in my docker compose.....any ideas how to work around this please?

Hi, I am also facing this issue with CouchDB 1.6 and HospitalRun 1.0.0-beta. However this issue is not showing in HospitalRun 0.9.8 after downgrading to CouchDB 1.6, that combination is running fine.

ok, after adding "hradmin" & "test" into couchdb as admin problem resolved for now. But there should be real solution to this for production use.

after adding "hradmin" and test into "couchdb" 1.6 i still get redirected to login

Name or password is incorrect. in Project Fauxton

Username: hradmin and password: test

stale commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Hello @fox1t. I see you closed this issue. Has it been fixed?

fox1t commented

Hi @adeolabadmus!
We're now working on a new major version (2.0) of HospitalRun. Sadly, this issue won't be resolved and we're forced to close this issue.
Can you contribute to the project? If so ping me on slack since we will need a big community effort to build the best HIS!