Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chris-visser/acl
https://github.com/chris-visser/acl
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/chris-visser/acl
- Owner: chris-visser
- Created: 2023-11-09T16:55:12.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-11-10T18:23:46.000Z (about 1 year ago)
- Last Synced: 2024-11-05T23:14:06.118Z (3 months ago)
- Language: JavaScript
- Size: 448 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Privileges ACL
**WIP: Do not use this library. I'm updating this to modern standards**
An access control library to manage and check user privileges.
This library has been build to support roles and groups out of the box.Multiple storage mechanisms are supported or can easily be created. The Mongo
and Meteor (Minimongo) storage are included by default.## Getting started
```
npm install
```JSDocs found at https://chris-acl.netlify.app/
### Selecting a storage
```
import Privileges, {MongoStorage, MeteorStorage} from 'privileges';// Using the mongodb storage
const MongoACL = new Privileges(MongoStorage);// Using the Meteor storage
const MeteorACL = new Privileges(MeteorStorage);
```### Granting and checking privileges
Simple checking
```
ACL.grant('chris', 'read');// Simple check
ACL.can('chris', 'read'); // Returns true//Support checking multiple privileges (OR)
ACL.can('chris', ['read', 'write']); // Returns true// Failure scenario
ACL.can('chris', 'write'); // Returns false
```Component scoped checking
```
ACL.grant('chris', 'read', 'userList');// Simple check
ACL.can('chris', 'read', 'userList'); // Returns true// Fail, because the privilege is scoped to a component
ACL.can('chris', 'read'); // Returns false
```## Authors
* **Chris Visser** - *Creator* - [Github](https://github.com/Redroest)
See also the list of [contributors](https://github.com/your/project/contributors) who participated in this project.
## License
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details