0.2.1 • Published 8 years ago

samjs-mongo-auth v0.2.1

Weekly downloads
19
License
-
Repository
github
Last release
8 years ago

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

nametypedefaultdescription
insertablebooleantrueallows user to create documents even when access to parts of it are forbidden
deletablebooleanfalseallows user to delete documents even when access to parts of it are forbidden
0.2.1

8 years ago

0.2.0

8 years ago

0.1.1

9 years ago

0.1.0

9 years ago