empower-permission
Given a permission set and a request return a permission token.
it will look in the PermissionMap
for for a url that matches the given URL.
If found, then it will return the token string associated with that path.
Otherwise, it will return the GeneralAccessToken
or '*'.
Paths will be parsed using the pathToRegexp
module.
g
PermissionToken
Example Token Strings:
'token:entity:create''token:entity:update''token:entity:sub-entity:read'
PermissionMap
This is a map of path strings to PermissionTokens
Example Map:
Usage
Building the Map from JSON
var PermissionMap = ;var map = PermissionMap
Building the Map Programmatically
var PermissionMap = ;var map = ; map var token = map; console; // will output "url:token:list"