pouchdb-community / pouchdb-authentication

User authentication plugin for PouchDB and CouchDB.
Apache License 2.0
777 stars 117 forks source link

Add user to database members on signup #235

Open fang0rnz opened 6 years ago

fang0rnz commented 6 years ago

Is this currently possible?

As of now I have a CouchDB instance with multiple databases. Each one of these databases represents a clinic that has several users with two possible roles: owner (would be database admin) and multiple employees (would be members, for instance, a secretary who would be able to perform basic non admin crud operations).

What I want to accomplish is: Using the signup method, add the user to members security config.

I have read all the docs and it seems to me that you have to be an instance / db admin to accomplish this. I thought about using a lambda function with admin permissions hardcoded when signing up in order to add the said user as a db member and then use pouchdb-authentication to login and operate the database normally but it seems a little hacky. Is this a correct approach?

ptitjes commented 6 years ago

@fang0rnz PouchDB Authentication does not modify the security object of the database. That plugin https://github.com/tyler-johnson/pouchdb-security-helper does however.