pn

permission-nodes

Node based permissions for JavaScript.

Showing:

Popularity

Downloads/wk

10

GitHub Stars

0

Maintenance

Last Commit

5yrs ago

Contributors

0

Package

Dependencies

0

Size (min+gzip)

0.9KB

License

ISC

Type Definitions

Tree-Shakeable

No?

Categories

Readme

Build Status PRs Welcome js-standard-style

Node based permissions for JavaScript.

Setup

Install with npm

npm i --save permission-nodes

Require permission-nodes, create a new PermissionNodes and pass in a permission object (optional). You can import an existing, exported, permissions object here. (see below for .export()).

const PermissionNodes = require('permission-nodes');
const perm = new PermissionNodes({
  permissionObject: {
    matt: {},
  },
});

Usage

.give()

give permission node...

perm.give('matt').node('javascript');

...or give a bunch of nodes

perm.give('matt')
  .node('javascript')
  .node('github.fork')
  .node('github.pr')
  .node('github.issue');

.have()

check for a permission node...

perm.does('matt').have().node('javascript'); // true

...or check for a bunch of nodes

perm.does('matt').have().nodes([
  'javascript',
  'github.fork',
  'github.pr',
  'github.pr',
]); // true

.take()

take a permission node away...

perm.take('matt').node('javascript.ninja.sword');

...or take away a bunch of nodes...

perm.take('matt')
  .node('github.fork')
  .node('github.pr')
  .node('github.pr');

...or a whole group

perm.take('matt').node('github');

.inheritance()

inherit nodes from another id...

perm.give('james').inheritance('matt');

.import()

hotload a new permissions object

perm.import({your: 'permissions'});

.export()

export the current permissions object

perm.export(); // [object Object]

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100