amr
acl-mem-regexp
npm i acl-mem-regexp
amr

acl-mem-regexp

This replacement for the memory-backend that ships with node_acl supports regular expressions for the resource

by Joshua Chan

0.2.0 (see all)License:ISCTypeScript:Not Found
npm i acl-mem-regexp
Readme

Memory Backend with RegExp support for NODE ACL

This replacement for the memory-backend that ships with acl supports regular expressions for the resource.

##Status

BuildStatus DependencyStatus

##Installation

Using npm:

npm install acl-mem-regexp

##Examples

Explicitly allow access to a resource and its subresource.

var acl = require('acl')
    , Backend = require('acl-mem-regexp')
    , acl = new acl(new Backend())
;

acl.allow([
    {
        roles:['someRole'], 
        allows:[
            {resources:'/resource(/[0-9]+)?', permissions:['get', 'post', 'put']},
            {resources:'/resource/[0-9]+/subresource/[0-9]+', permissions:['get', 'post', 'put']}
        ]
    }
])

Do not include ^ and $. Those will be added for you.

You can also omit access to the parent resource while allowing access to the subresource.

acl.allow([
    {
        roles:['someOtherRole'], 
        allows:[
            {resources:'/resource/[0-9]+/subresource/[0-9]+', permissions:['get', 'post', 'put']}
        ]
    }
])

Downloads/wk

96

GitHub Stars

10

LAST COMMIT

7yrs ago

MAINTAINERS

1

CONTRIBUTORS

1

OPEN ISSUES

2

OPEN PRs

2
VersionTagPublished
0.2.0
latest
7yrs ago
No alternatives found
No tutorials found
Add a tutorial