empower-role
Given a role map, a set of roles and a permission can the user access?
Role Map
Maps a set of roles to a set of permission strings and CRUD actions against that set (expressed as HTTP/1.1 methods).
Set of user roles
Simply an array of roles to check against.
Permission
A string that represents a system action or request.
Usage
var RoleMap = Map;var Role = Role; // Alternatively you can supply JSON via the RoleMap.fromJson function.var map = 'get' 'post' ) ) 'delete' ) ); var userRoles = 'role-name' 'other-role' ; var isAllowed1 = map;var isAllowed2 = map;var isAllowed3 = map; // will print "true, true, true"// the most permissive result is always returned.console;