UNPKG

3.4 kBMarkdownView Raw
1# permission
2
3[![Build Status](https://travis-ci.org/lykmapipo/permission.svg?branch=master)](https://travis-ci.org/lykmapipo/permission)
4[![Dependencies Status](https://david-dm.org/lykmapipo/permission/status.svg?style=flat-square)](https://david-dm.org/lykmapipo/permission)
5[![Deploy to Heroku](https://www.herokucdn.com/deploy/button.png)](https://heroku.com/deploy?template=https://github.com/lykmapipo/permission/tree/master)
6
7A representation of ability to perform an action or access a resource.
8
9Permissions are immutable and reflect an application's raw functionality (opening files, printing files, creating users, etc). This is what allows a system's security policy to be dynamic: because Permissions represent raw functionality and only change when the application's source code changes, they are immutable at runtime - they represent 'what' the system can do.
10
11[Demo](https://permision.herokuapp.com/v1/permissions)
12
13## Requirements
14
15- [nodejs v8.11.1+](https://nodejs.org)
16- [npm v5.6.0+](https://www.npmjs.com/)
17- [MongoDB v3.4.10+](https://www.mongodb.com/)
18- [mongoose v5.2.5+](https://github.com/Automattic/mongoose)
19
20## Installation
21
22```sh
23npm install @lykmapipo/permission --save
24```
25
26## Usage
27
28```js
29const { connect } = require('@lykmapipo/mongoose-common');
30const { start, mount } = require('@lykmapipo/express-common');
31const { Permission, permissionRouter } = require('@lykmapipo/permission');
32
33// connect to mongodb
34connect(process.env.MONGODB_URI, error => { ... });
35
36// mount permission http router
37mount(permissionRouter);
38
39// fire the http server
40start(error => { ... });
41```
42
43## Demo
44[View Demo](https://permision.herokuapp.com/v1/permissions)
45[View apidoc](https://lykmapipo.github.io/permission/)
46
47## Testing
48
49- Clone this repository
50
51- Install all development dependencies
52
53```sh
54npm install
55```
56
57- Run example
58
59```sh
60npm run dev
61```
62
63- Then run test
64
65```sh
66npm test
67```
68
69## Contribute
70
71It will be nice, if you open an issue first so that we can know what is going on, then, fork this repo and push in your ideas. Do not forget to add a bit of test(s) of what value you adding.
72
73## References
74- [Role Based Access Control](https://en.wikipedia.org/wiki/Role-based_access_control)
75- [Apache Shiro - Permission](https://shiro.apache.org/permissions.html)
76
77## Licence
78
79The MIT License (MIT)
80
81Copyright (c) lykmapipo & Contributors
82
83Permission 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:
84
85The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
86
87THE 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.