datumo-scopes
datumo-scopes is an opinionated library that helps you control access to data on Datumo models on a per-property basis using scopes.
What is datumo-scopes?
Documentation
Example Usage
Datumo requires Node.js 4.0 or later.
$ npm install --save datumo-scopes datumo
let Datumo = let DatumoScopes = Model static { return id: type: 'integer' minimum: 0 required: true givenName: type: 'string' required: true middleName: type: 'string' familyName: type: 'string' required: true email: type: 'string' format: 'email' } static { return name: 'givenName' 'middleName' 'familyName' email: 'email' } static { // ... } let personScopes = Person // ... server // Data:// {// id: 12345,// givenName: 'Amanda',// familyName: 'Bryson',// email: 'amanda@example.com'// } // Request:// req.user.scopes === ['Person-read-name']// GET /person/12345 // Response:// {// givenName: 'Amanda',// familyName: 'Bryson'// }
License
MIT