apache / apache/couchdb-nano

Missing API to edit database permissions

Open
#193 1 comment 22 reactions 0 assignees View on GitHub
enhancement
Dominant language
JavaScript
Stars
689
Forks
167
Avg merge
1h
Merged PRs (30d)
1

Description

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: [] },
}
});
```

Contributor guide

Open the contributing guide

Research direction

Start by tracing nano.request and the existing nano.db wrapper methods to understand how database-scoped APIs are exposed. Compare the proposed security and secure operations with the supplied _security GET and PUT workaround; done means callers can retrieve and update database permissions without constructing those requests themselves.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
api, databases, security
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.