|
1 | 1 | # TrivialPermissions |
2 | | -A simple RBAC implementation that is datasource agnostic. |
| 2 | + |
| 3 | +A simple RBAC implementation with object level permissions that is datasource agnostic. I've designed it to be easy to |
| 4 | +integrate into existing projects, while being flexible and very simple to use. It may not be the most powerful |
| 5 | +permission system ever devised, but it is one of the easiest to get up and running with in very little time. |
| 6 | + |
| 7 | +## Installation |
| 8 | + |
| 9 | +### Node.js / Browserify |
| 10 | + |
| 11 | +Simply install with NPM: |
| 12 | + |
| 13 | +```bash |
| 14 | +$ npm install --save trivialperms |
| 15 | +``` |
| 16 | + |
| 17 | +### Bower |
| 18 | + |
| 19 | +```bash |
| 20 | +$ bower install --save trivialperms |
| 21 | +``` |
| 22 | + |
| 23 | +### Generic |
| 24 | + |
| 25 | +Download the latest release from the [Releases][] page, and put it in your project. |
| 26 | + |
| 27 | +[Releases]: https://github.com/trivialsoftware/TrivialPermissions/releases |
| 28 | + |
| 29 | +## Usage |
| 30 | + |
| 31 | +TrivialPermissions is built on the concept of 'role based access control'. In essence, a `user` is a member of a |
| 32 | +`group`. That group has specific `permissions`. A user may also have specific `permissions` granted. These permissions |
| 33 | +are on an `object` basis. |
| 34 | + |
| 35 | +### Permissions |
| 36 | + |
| 37 | +In TrivialPermissions, a `permission` is a string that looks like the following: |
| 38 | + |
| 39 | +```javascript |
| 40 | +'ObjectDescriptor/PermissionDescriptor' |
| 41 | +``` |
| 42 | + |
| 43 | +This allows us to specify permissions on a per object basis. If you want to specify the permissions on an object from |
| 44 | +the database, simply use that id as the object in the permission: `3dqZ7/somePerm`. Alternatively, you may wish to use |
| 45 | +more generic object names, like, `'Accounting'`, or `'Posts'`, or something along those lines. TrivialPermissions does |
| 46 | +not care, so long as you specify an object descriptor and a permission descriptor. |
| 47 | + |
| 48 | +#### Glob Matching |
| 49 | + |
| 50 | +TrivialPermissions has special support for `*`. It can be used as either an object descriptor, or a permission descriptor. |
| 51 | +It matches any permissions passed in. If you want a user or group to have all permissions for all objects, specify |
| 52 | +`'*/**'`. |
| 53 | + |
| 54 | +### Groups |
| 55 | + |
| 56 | +TBD. |
| 57 | + |
| 58 | +### Checking Permissions |
| 59 | + |
| 60 | +TBD. |
0 commit comments