An open API service indexing awesome lists of open source software.

https://github.com/sindreslungaard/guard

Dead simple permission manager
https://github.com/sindreslungaard/guard

Last synced: 4 months ago
JSON representation

Dead simple permission manager

Awesome Lists containing this project

README

          

### Permission Guard
Dead simple, zero dependency nodejs permission manager.

Permissions are string based and can be split into nodes with a `dot` separator. Wildcards can be applied to each permission node.

### Installation
```nodejs
npm i @sindres/guard
```

### Example usage
```javascript
const guard = require('@sindres/guard');

let myPermissions = [
'site.frontpage',
'site.dashboard',
'site.profiles.*'
];

let authorized = guard(myPermissions, [
'site.frontpage',
'site.profiles.comment',
'site.profiles.delete'
]);

console.log(authorized) // true
```