Nefarious Planetary Meddling

    trails-policy

    2.0.0 • Public • Published

    trails-policy

    Gitter NPM version Build status Dependency Status Code Climate Follow @trailsjs on Twitter

    Note: This module is deprecated in Trails v2. It will be merged into trailsjs/trails in v3.

    Trails Policy Class. Exposes Trails Application resources to the class instances. Policies should extend this Class.

    Usage

    In api/policies/MyPolicy.js:

    const Policy = require('trails-policy')
     
    class MyPolicy extends Policy {
      policyMethod () {
        // ...
      }
    }

    In config/policies.js:

    module.exports = {
      SomeController: {
        doSomething: ['MyPolicy.policyMethod']
      }
    }

    Note: Even if you are only applying one policy to a controller method, you should still enclose the string 'MyPolicy.policyMethod' in an array.

    Install

    License

    MIT

    Install

    npm i trails-policy

    DownloadsWeekly Downloads

    5

    Version

    2.0.0

    License

    MIT

    Last publish

    Collaborators

    • trails