pouchdb-community / pouchdb-authentication

User authentication plugin for PouchDB and CouchDB.
Apache License 2.0
775 stars 118 forks source link

Can this plugin change a users role? #252

Open travbus opened 5 years ago

travbus commented 5 years ago

Expected Behavior

Current Behavior

Possible Solution

Steps to Reproduce (for bugs)

1. 2. 3. 4.

Context

Your Environment

ptitjes commented 5 years ago

It can.

travbus commented 5 years ago

How abouts? I get how to write the validation rule in the _users _design/_auth doc to except it. But how do I pass the role. I tried code below with no luck

db.signUp('robin', 'dickgrayson', {
  metadata : {
    email : 'robin@boywonder.com',
    birthday : '1932-03-27T00:00:00.000Z',
    likes : ['acrobatics', 'short pants', 'sidekickin\''],
  },
 roles : { ['basic']
  }
}, function (err, response) {
  // etc.
});
travbus commented 5 years ago

Never mind I figured it out posted answer here

https://stackoverflow.com/questions/53414015/pouchdb-authentication-how-do-i-set-roles-for-a-new-user