Package Exports
- shiro-perms
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (shiro-perms) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
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-permsOr
yarn add shiro-permsRunning the tests
Use:
npm run testOr
yarn testUsage
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'])
// FalseCheck ANY permissions - OR
perms.checkAny(['store:view', 'store:edit:9999'])
// TrueAdd
....
Remove
...
Reset
...
Built With
- msgpack5 - A msgpack v5 implementation for node.js
Author
- Ricardo Lopes - Initial work - rjblopes
License
This project is licensed under the MIT License
Acknowledgments
- Inspired by: https://github.com/entrecode/shiro-trie