connect-acl
Simple ACL for Connect/Express.
connect-acl can work only with Roles and Permissions.
It consists of these parts:
- Connect middleware
- Routing helper
- Route handler helper
- Template helper
Configuring
// Permissions and roles config.var roles = admin: can: 'create article' 'read article' 'edit article' user: can: 'read article'; // Create Acl instancevar role = roles ; // Global failure handlers (optional)role;role; // Сonnect a middlewareapp; // Authorizingapp;
Using router helper
// Simple authorized/unauthorized checkingapp;app; // Check permissionsapp;app; // Check for roleapp;app; // This checks whether user has 'admin' AND 'user' rolesapp; // This checks whether user has 'admin' OR 'user' rolesapp;
Using in route handler
app;
Using in templates (i.e. Jade)
extends layoutblock content h1= title if role.is('admin') p Hello Admin! else p Hello Man!