samjs-mongo-auth
v0.2.1
Published
Adds authorization for samjs-mongo
Downloads
12
Readme
samjs-mongo-auth
Adds authorization system for samjs-mongo.
Getting Started
npm install --save samjs-mongo-auth
Usage
samjs.plugins([
// samjs-auth and samjs-mongo are needed before samjs-mongo-auth
require("samjs-auth"),
require("samjs-mongo"),
require("samjs-mongo-auth")
])
.options()
.configs()
.models({
name: "someModel",
db: "mongo",
plugins: {
auth: authOptions, // (optional) auth plugin will be enabled for all monog models by default
// to disable auth
noAuth: null
},
schema: {
someProp: {
type: String,
read: true, // all can read
write: "root" // only root can write
}
}
}).startup(server)
authOptions
name | type | default | description ---: | --- | --- | --- insertable | boolean | true | allows user to create documents even when access to parts of it are forbidden deletable | boolean | false | allows user to delete documents even when access to parts of it are forbidden