Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
cradle_security
Advanced tools
Add users, roles and authorization creation commands to Cradle module
This module is a simple extension of the Cradle module for CouchDB database.
To install this module use npm as usual:
$ npm install cradle_security
or
$ npm install cradle_security --save-dev
if you want to run tests.
// load module
var couchDB = require('cradle_security')({
debug: true, // set true to see all log messages
adminUsername: "admin", // set your admin username
adminPassword: "password" // set your admin password
});
// setup the database
couchDB.setup({
host: '127.0.0.1', // CouchDB host (default localhost only)
port: 5984, // CouchDB port
cache: true, // CouchDB cache
timeout: 5000 // connection timeout
});
// create a new connection
conn = new (couchDB.Connection)({
auth: {
username: "admin", // set your admin username
password: "password" // set your admin password
}
});
db.createWithUser(
"new_user", // username
"new_user_password", // password
[ "admins" ], // array of roles
function (err, res) { // callback
console.log(res); // it should be { ok: true } if no error occurred
}
);
db.addUser(
"new_user", // username
"new_user_password", // password
[ "admins" ], // array of roles
function (err, res) { // callback
console.log(res); // it should seem
// { ok: true, id:
// 'org.couchdb.user:new_user',
// rev: '1-83d5aba64688501431753b7cc13d7578' }
// if no error occurred
}
);
db.delUser(
"new_user", // username
function (err, res) { // callback
console.log(res); // it should seem
// { ok: true, id:
// 'org.couchdb.user:new_user',
// rev: '2-645980a99208ef5902cb216e5a49526e' }
// if no error occurred
}
);
db.addRoles(
[ "admins" ], // array of admin roles
[ "guests" ], // array of member roles
function (err, res) { // callback
console.log(res); // it should be { ok: true } if no error occurred
}
);
To create your own documentation you must install JSDuck and type in your terminal:
$ cd /path-of-package
$ ./gen_doc.sh
See full documentation into doc folder and some examples into test folder within the cradle_security package.
For all CouchDB supported function please refer to cradle documentation.
FAQs
Add users, roles and authorization creation commands to Cradle module
We found that cradle_security demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.