Permalink
Browse files

initial commit

  • Loading branch information...
0 parents commit 9774378d531bb34cb6a73d6ae4414306da64d5e0 @ekryski ekryski committed Oct 14, 2016
Showing with 295 additions and 0 deletions.
  1. +4 −0 .babelrc
  2. +13 −0 .editorconfig
  3. +34 −0 .gitignore
  4. +16 −0 .istanbul.yml
  5. +9 −0 .npmignore
  6. +8 −0 .travis.yml
  7. +22 −0 LICENSE
  8. +52 −0 README.md
  9. +21 −0 example/app.js
  10. +2 −0 mocha.opts
  11. +70 −0 package.json
  12. +28 −0 src/index.js
  13. +16 −0 test/index.test.js
@@ -0,0 +1,4 @@
+{
+ "plugins": [ "add-module-exports" ],
+ "presets": [ "es2015" ]
+}
@@ -0,0 +1,13 @@
+# http://editorconfig.org
+root = true
+
+[*]
+indent_style = space
+indent_size = 2
+end_of_line = lf
+charset = utf-8
+trim_trailing_whitespace = true
+insert_final_newline = true
+
+[*.md]
+trim_trailing_whitespace = false
@@ -0,0 +1,34 @@
+.DS_Store
+
+# Logs
+logs
+*.log
+
+# Runtime data
+pids
+*.pid
+*.seed
+
+# Directory for instrumented libs generated by jscoverage/JSCover
+lib-cov
+
+# Coverage directory used by tools like istanbul
+coverage
+
+# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
+.grunt
+
+# Compiled binary addons (http://nodejs.org/api/addons.html)
+build/Release
+
+# Dependency directory
+# Commenting this out is preferred by some people, see
+# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git-
+node_modules
+
+# Users Environment Variables
+.lock-wscript
+
+# The compiled/babelified modules
+lib/
+coverage/
@@ -0,0 +1,16 @@
+verbose: false
+instrumentation:
+ root: ./src/
+ excludes: []
+ include-all-sources: true
+reporting:
+ print: summary
+ reports:
+ - html
+ - text
+ - lcov
+ watermarks:
+ statements: [50, 80]
+ lines: [50, 80]
+ functions: [50, 80]
+ branches: [50, 80]
@@ -0,0 +1,9 @@
+.editorconfig
+.jshintrc
+.travis.yml
+.istanbul.yml
+.babelrc
+.idea/
+src/
+test/
+!lib/
@@ -0,0 +1,8 @@
+language: node_js
+node_js:
+ - 'node'
+ - 'iojs'
+code_climate:
+ repo_token: 'your repo token'
+after_script:
+ - codeclimate-test-reporter < lcov.info
@@ -0,0 +1,22 @@
+The MIT License (MIT)
+
+Copyright (c) 2016 Feathers
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
@@ -0,0 +1,52 @@
+# feathers-permissions
+
+[![Build Status](https://travis-ci.org/feathersjs/feathers-permissions.png?branch=master)](https://travis-ci.org/feathersjs/feathers-permissions)
+[![Code Climate](https://codeclimate.com/github/feathersjs/feathers-permissions/badges/gpa.svg)](https://codeclimate.com/github/feathersjs/feathers-permissions)
+[![Test Coverage](https://codeclimate.com/github/feathersjs/feathers-permissions/badges/coverage.svg)](https://codeclimate.com/github/feathersjs/feathers-permissions/coverage)
+[![Issue Count](https://codeclimate.com/github/feathersjs/feathers-permissions/badges/issue_count.svg)](https://codeclimate.com/github/feathersjs/feathers-permissions)
+
+> Flexible and powerful permissions module for Feathers
+
+## Installation
+
+```
+npm install feathers-permissions --save
+```
+
+## Documentation
+
+Please refer to the [feathers-permissions documentation](http://docs.feathersjs.com/) for more details.
+
+## Complete Example
+
+Here's an example of a Feathers server that uses `feathers-permissions`.
+
+```js
+const feathers = require('feathers');
+const rest = require('feathers-rest');
+const hooks = require('feathers-hooks');
+const bodyParser = require('body-parser');
+const errorHandler = require('feathers-errors/handler');
+const plugin = require('feathers-permissions');
+
+// Initialize the application
+const app = feathers()
+ .configure(rest())
+ .configure(hooks())
+ // Needed for parsing bodies (login)
+ .use(bodyParser.json())
+ .use(bodyParser.urlencoded({ extended: true }))
+ // Initialize your feathers plugin
+ .use('/plugin', plugin())
+ .use(errorHandler());
+
+app.listen(3030);
+
+console.log('Feathers app started on 127.0.0.1:3030');
+```
+
+## License
+
+Copyright (c) 2016
+
+Licensed under the [MIT license](LICENSE).
@@ -0,0 +1,21 @@
+const feathers = require('feathers');
+const rest = require('feathers-rest');
+const hooks = require('feathers-hooks');
+const bodyParser = require('body-parser');
+const errorHandler = require('feathers-errors/handler');
+const plugin = require('../lib/index');
+
+// Initialize the application
+const app = feathers()
+ .configure(rest())
+ .configure(hooks())
+ // Needed for parsing bodies (login)
+ .use(bodyParser.json())
+ .use(bodyParser.urlencoded({ extended: true }))
+ // Initialize your feathers plugin
+ .use('/plugin', plugin())
+ .use(errorHandler());
+
+app.listen(3030);
+
+console.log('Feathers app started on 127.0.0.1:3030');
@@ -0,0 +1,2 @@
+--recursive test/
+--compilers js:babel-core/register
@@ -0,0 +1,70 @@
+{
+ "name": "feathers-permissions",
+ "description": "Flexible and powerful permissions module for Feathers",
+ "version": "0.0.0",
+ "homepage": "https://github.com/feathersjs/feathers-permissions",
+ "main": "lib/",
+ "keywords": [
+ "feathers",
+ "feathers-plugin"
+ ],
+ "license": "MIT",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/feathersjs/feathers-permissions.git"
+ },
+ "author": {
+ "name": "Feathers contributors",
+ "email": "hello@feathersjs.com",
+ "url": "https://feathersjs.com"
+ },
+ "contributors": [],
+ "bugs": {
+ "url": "https://github.com/feathersjs/feathers-permissions/issues"
+ },
+ "engines": {
+ "node": ">= 0.12.0"
+ },
+ "scripts": {
+ "prepublish": "npm run compile",
+ "publish": "git push origin --tags && npm run changelog && git push origin",
+ "release:patch": "npm version patch && npm publish",
+ "release:minor": "npm version minor && npm publish",
+ "release:major": "npm version major && npm publish",
+ "changelog": "github_changelog_generator && git add CHANGELOG.md && git commit -am \"Updating changelog\"",
+ "compile": "rimraf lib/ && babel -d lib/ src/",
+ "watch": "babel --watch -d lib/ src/",
+ "lint": "semistandard src/**/*.js test/**/*.js --fix",
+ "mocha": "mocha --opts mocha.opts",
+ "coverage": "istanbul cover _mocha -- --opts mocha.opts",
+ "test": "npm run compile && npm run lint && npm run coverage",
+ "start": "npm run compile && node example/app"
+ },
+ "semistandard": {
+ "env": [
+ "mocha"
+ ]
+ },
+ "directories": {
+ "lib": "lib"
+ },
+ "dependencies": {
+ "debug": "^2.2.0",
+ "feathers-errors": "^2.4.0"
+ },
+ "devDependencies": {
+ "babel-cli": "^6.16.0",
+ "babel-core": "^6.17.0",
+ "babel-plugin-add-module-exports": "^0.2.1",
+ "babel-preset-es2015": "^6.16.0",
+ "body-parser": "^1.15.2",
+ "chai": "^3.5.0",
+ "feathers": "^2.0.2",
+ "feathers-hooks": "^1.5.8",
+ "feathers-rest": "^1.5.0",
+ "istanbul": "^1.1.0-alpha.1",
+ "mocha": "^2.5.3",
+ "rimraf": "^2.5.4",
+ "semistandard": "^9.1.0"
+ }
+}
@@ -0,0 +1,28 @@
+import errors from 'feathers-errors';
+import makeDebug from 'debug';
+
+const debug = makeDebug('feathers-permissions');
+
+class Service {
+ constructor (options = {}) {
+ this.options = options;
+ }
+
+ find (params) {
+ return new Promise((resolve, reject) => {
+ // Put some async code here.
+ if (!params.query) {
+ return reject(new errors.BadRequest());
+ }
+
+ resolve([]);
+ });
+ }
+}
+
+export default function init (options) {
+ debug('Initializing feathers-permissions plugin');
+ return new Service(options);
+}
+
+init.Service = Service;
@@ -0,0 +1,16 @@
+import { expect } from 'chai';
+import plugin from '../src';
+
+describe('feathers-permissions', () => {
+ it('is CommonJS compatible', () => {
+ expect(typeof require('../lib')).to.equal('function');
+ });
+
+ it('basic functionality', () => {
+ expect(typeof plugin).to.equal('function', 'It worked');
+ });
+
+ it('exposes the Service class', () => {
+ expect(plugin.Service).to.not.equal(undefined);
+ });
+});

0 comments on commit 9774378

Please sign in to comment.