2.0.3 • Published 3 months ago

shiro-perms v2.0.3

Weekly downloads
58
License
MIT
Repository
github
Last release
3 months ago

Shiro Perms

Create, check and manipulate permissions using a Trie data object and Apache Shiro write style.

Getting Started

Module exposes a class that can be used to create permissions objects. Each instance object represents a set of credentials which can be manipulated and verified using instance methods.

const ShiroPerms = require('shiro-perms');
import ShiroPerms from 'shiro-perms';

Documentation API

Installing

Use:

npm i shiro-perms

Or

yarn add shiro-perms

Running the tests

Use:

npm run test

Or

yarn test

Usage

Create

Using class constructor:

const perms = new ShiroPerms();

Static methods:

const perms = ShiroPerms.from('store:view,edit store:*:1123');
const perms = ShiroPerms.from(['store:view,edit', 'store:*:1123']);

Check

Check ALL permissions - AND

perms.check('store:view:9999')
// True

perms.check('store:view store:edit:*')
// True

perms.check(['store:view', 'store:edit:9999'])
// False

Check ANY permissions - OR

perms.checkAny(['store:view', 'store:edit:9999'])
// True

Add

....

Remove

...

Reset

...

Built With

  • msgpack5 - A msgpack v5 implementation for node.js

Author

License

This project is licensed under the MIT License

Acknowledgments

2.0.3

3 months ago

2.0.2

2 years ago

2.0.1

5 years ago

2.0.0

6 years ago

1.1.0

6 years ago

1.0.0

6 years ago