minimatch-permissions
Define dot-notated permissions and match them using minimatch.
Usage
The api is very clean and simple. In this example, we use ES6 classes to define a User and a Tree.
; permissions = grant: 'Tree.Plant' // subset in form of action 'Tree.PlantedByYou' // subset in form of selection 'Tree.Tall.Chop' // combination of subsets permissions = grant: 'Tree' // no subset /** * The user is only permitted when he's granted "Tree" or "Tree.Plant" */ { ; // throws error for you // 💦🌱 } /** * The user is only permitted to hug trees planted by himself */ { const auth = ; if auth // 😙🌳 } /** * The user could be restricted to chop tall trees */ { ; // 🌳⛏ }