samjs-files-auth

Adds authorization for samjs-files


License
MIT
Install
npm install samjs-files-auth@0.2.1

Documentation

samjs-files-auth

Adds authorization for samjs-files.

Getting Started

npm install --save samjs-files-auth

Usage

// server-side
samjs
.plugins([
  require("samjs-auth"),
  require("samjs-files"),
  require("samjs-files-auth")
])
.options()
.configs()
.models({
  name: "someFile",
  db: "files",
  files: "package.json",
  plugins: {
    // (optional) to manually activate auth.
    // auth will be activated by default for all models
    auth: {}
    // to disable auth plugin use this instead:
    noAuth: {}
  },
  access:{
    read: true, // allowed for all
    write: "root", // allowed for root only
    insert: "root", // defaults to value of write
    update: "root", // defaults to value of write
    delete: "root" // defaults to value of write

  }
  // optional, permission checker used for this model
  // can be a name or a custom function
  // see samjs-auth for further information
  permissionChecker: "containsUser"
  }
})
.startup(server)