https://github.com/trailsjs/trails-policy
:globe_with_meridians: Trails Policy Class
https://github.com/trailsjs/trails-policy
Last synced: about 2 months ago
JSON representation
:globe_with_meridians: Trails Policy Class
- Host: GitHub
- URL: https://github.com/trailsjs/trails-policy
- Owner: trailsjs
- License: mit
- Created: 2016-01-10T07:52:37.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-12-22T01:42:49.000Z (over 8 years ago)
- Last Synced: 2024-11-07T14:56:21.438Z (7 months ago)
- Language: JavaScript
- Homepage:
- Size: 10.7 KB
- Stars: 1
- Watchers: 8
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# trails-policy
[![Gitter][gitter-image]][gitter-url]
[![NPM version][npm-image]][npm-url]
[![Build status][ci-image]][ci-url]
[![Dependency Status][daviddm-image]][daviddm-url]
[![Code Climate][codeclimate-image]][codeclimate-url]
[![Follow @trailsjs on Twitter][twitter-image]][twitter-url]### Note: This module is deprecated in Trails v2. It will be merged into [trailsjs/trails](https://github.com/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:
```js
const Policy = require('trails-policy')class MyPolicy extends Policy {
policyMethod () {
// ...
}
}
```In config/policies.js:
```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](https://github.com/trailsjs/trails/blob/master/LICENSE)[npm-image]: https://img.shields.io/npm/v/trails-policy.svg?style=flat-square
[npm-url]: https://npmjs.org/package/trails-policy
[ci-image]: https://img.shields.io/travis/trailsjs/trails-policy/master.svg?style=flat-square
[ci-url]: https://travis-ci.org/trailsjs/trails-policy
[daviddm-image]: http://img.shields.io/david/trailsjs/trails-policy.svg?style=flat-square
[daviddm-url]: https://david-dm.org/trailsjs/trails-policy
[codeclimate-image]: https://img.shields.io/codeclimate/github/trailsjs/trails-policy.svg?style=flat-square
[codeclimate-url]: https://codeclimate.com/github/trailsjs/trails-policy
[gitter-image]: http://img.shields.io/badge/+%20GITTER-JOIN%20CHAT%20%E2%86%92-1DCE73.svg?style=flat-square
[gitter-url]: https://gitter.im/trailsjs/trails
[twitter-image]: https://img.shields.io/twitter/follow/trailsjs.svg?style=social
[twitter-url]: https://twitter.com/trailsjs