ACL (Access Control List) library for Node.js, version 0.4.11, last updated in 2019. Provides role-based permission management with support for Redis, MongoDB, and in-memory backends. Includes Express middleware for protecting routes. Compared to alternatives like accesscontrol or casl, acl is older and more minimalistic, with a callback/promise API and limited TypeScript support. The package is in maintenance mode; no active development.
npm install aclVerified import paths — ran on the pinned version, not inferred.
Creates an ACL instance with Redis backend, allows admin full access to blogs, assigns user 'john' as admin, and checks if john can delete blogs.
Use acl.allow('admin', '*', '*') to grant all permissions on all resources, or list all resources explicitly.Use promises or callbacks; do not attempt method chaining.
Omit callback parameter and use .then().catch() or async/await.
Ensure redisClient is connected before instantiating ACL.
Pass option object with 'role' and 'resource' or use acl.middleware(3, 'user', 'username') for dynamic roles.
Use a different variable name for the instance, e.g., const aclInstance = new acl(new acl.redisBackend(client)); aclInstance.allow(...).
Start Redis server with 'redis-server' or provide correct host/port in redis.createClient().
Run 'npm install acl' in your project directory.
Use app.use(acl.middleware()) instead of app.use(acl.middleware).