Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing API to edit database permissions #193

Open
BananaAcid opened this issue Jan 20, 2020 · 1 comment
Open

Missing API to edit database permissions #193

BananaAcid opened this issue Jan 20, 2020 · 1 comment

Comments

@BananaAcid
Copy link

BananaAcid commented Jan 20, 2020

Nano does not have any functionality to add permissions (users/roles) to a database. Always needed after DB creation.

expected - an API like:

nano.db.security([callback]) -- getting the security info
nano.db.secure(permObj, [callback]) -- setting security object

reason:
Creating a user and manually its database (to know when it is ready to create multiple documents inside), there is no owning user set.
db.create(name, callback) has no option to set user security.
Other basic functions also have a wrapper (like .get()).
Would help with making it easy to use couchDB without having to read and abstract the couchdb-docu-curl calls to a nano.request.

workaround - call manually:

// retrive
let perms = await nano.request({db: targetedDb, method: 'get', path: '/_security');

// save
await nano.request({db: targetedDb, method: 'put', path: '/_security', body:
	{
		admins:  { names: [newuser_email, 'Administrator'], roles: ["admins"] },
		members: { names: [newuser_email], roles: [] },
	}
});
@tgelu
Copy link

tgelu commented May 6, 2020

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants