trailsjs/trails

View on GitHub
lib/Policy.js

Summary

Maintainability
A
0 mins
Test Coverage
/**
 * Trails Policy Class.
 */
module.exports = class TrailsPolicy {

  constructor (app) {
    Object.defineProperty(this, 'app', {
      enumerable: false,
      writable: false,
      value: app
    })
  }

  /**
   * Policy configuration
   */
  static config () {
  }

  /**
   * Return the id of this policy
   */
  get id () {
    return this.constructor.name.replace(/(\w+)Policy/, '$1').toLowerCase()
  }

  /**
   * Return a reference to the Trails logger
   */
  get log () {
    return this.app.log
  }

  /**
   * Return a reference to the Trails configuration map.
   */
  get config () {
    return this.app.config
  }

  get services () {
    return this.app.services
  }
}