Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some markdown style fixes #233

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 25 additions & 8 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#NODE ACL - Access Control Lists for Node
# NODE ACL - Access Control Lists for Node

This module provides a minimalistic ACL implementation inspired by Zend_ACL.

@@ -14,13 +14,13 @@ A Redis, MongoDB and In-Memory based backends are provided built-in in the modul

Follow [manast](http://twitter.com/manast) for news and updates regarding this library.

##Status
## Status

[![BuildStatus](https://secure.travis-ci.org/OptimalBits/node_acl.png?branch=master)](http://travis-ci.org/OptimalBits/node_acl)
[![Dependency Status](https://david-dm.org/OptimalBits/node_acl.svg)](https://david-dm.org/OptimalBits/node_acl)
[![devDependency Status](https://david-dm.org/OptimalBits/node_acl/dev-status.svg)](https://david-dm.org/OptimalBits/node_acl#info=devDependencies)

##Features
## Features

- Users
- Roles
@@ -29,15 +29,15 @@ Follow [manast](http://twitter.com/manast) for news and updates regarding this l
- Express middleware for protecting resources.
- Robust implementation with good unit test coverage.

##Installation
## Installation

Using npm:

```javascript
npm install acl
```

##Documentation
## Documentation

* [addUserRoles](#addUserRoles)
* [removeUserRoles](#removeUserRoles)
@@ -57,7 +57,7 @@ npm install acl
* [middleware](#middleware)
* [backend](#backend)

##Examples
## Examples

Create your acl module by requiring it and instantiating it with a valid backend instance:

@@ -205,6 +205,7 @@ app.put('/blogs/:id/comments/:commentId', acl.middleware(3, 'joed', 'post'), fun
## Methods

<a name="addUserRoles"/>

### addUserRoles( userId, roles, function(err) )

Adds roles to a given user id.
@@ -220,6 +221,7 @@ __Arguments__
---------------------------------------

<a name="removeUserRoles"/>

### removeUserRoles( userId, roles, function(err) )

Remove roles from a given user.
@@ -235,6 +237,7 @@ __Arguments__
---------------------------------------

<a name="userRoles" />

### userRoles( userId, function(err, roles) )

Return all the roles from a given user.
@@ -249,6 +252,7 @@ __Arguments__
---------------------------------------

<a name="roleUsers" />

### roleUsers( rolename, function(err, users) )

Return all users who has a given role.
@@ -263,6 +267,7 @@ __Arguments__
---------------------------------------

<a name="hasRole" />

### hasRole( userId, rolename, function(err, hasRole) )

Return boolean whether user has the role
@@ -278,6 +283,7 @@ __Arguments__
---------------------------------------

<a name="addRoleParents" />

### addRoleParents( role, parents, function(err) )

Adds a parent or parent list to role.
@@ -293,6 +299,7 @@ __Arguments__
---------------------------------------

<a name="removeRoleParents" />

### removeRoleParents( role, parents, function(err) )

Removes a parent or parent list from role.
@@ -310,6 +317,7 @@ __Arguments__
---------------------------------------

<a name="removeRole" />

### removeRole( role, function(err) )

Removes a role from the system.
@@ -324,6 +332,7 @@ __Arguments__
---------------------------------------

<a name="removeResource" />

### removeResource( resource, function(err) )

Removes a resource from the system
@@ -338,6 +347,7 @@ __Arguments__
---------------------------------------

<a name="allow" />

### allow( roles, resources, permissions, function(err) )

Adds the given permissions to the given roles over the given resources.
@@ -365,6 +375,7 @@ __Arguments__
---------------------------------------

<a name="removeAllow" />

### removeAllow( role, resources, permissions, function(err) )

Remove permissions from the given roles owned by the given role.
@@ -383,6 +394,7 @@ __Arguments__
---------------------------------------

<a name="allowedPermissions" />

### allowedPermissions( userId, resources, function(err, obj) )

Returns all the allowable permissions a given user have to
@@ -402,6 +414,7 @@ __Arguments__
---------------------------------------

<a name="isAllowed" />

### isAllowed( userId, resource, permissions, function(err, allowed) )

Checks if the given user is allowed to access the resource for the given
@@ -418,6 +431,7 @@ __Arguments__

---------------------------------------
<a name="areAnyRolesAllowed" />

### areAnyRolesAllowed( roles, resource, permissions, function(err, allowed) )

Returns true if any of the given roles have the right permissions.
@@ -433,6 +447,7 @@ __Arguments__

---------------------------------------
<a name="whatResources" />

### whatResources(role, function(err, {resourceName: [permissions]})

Returns what resources a given role has permissions over.
@@ -459,6 +474,7 @@ __Arguments__
---------------------------------------

<a name="middleware" />

### middleware( [numPathComponents, userId, permissions] )

Middleware for express.
@@ -476,6 +492,7 @@ __Arguments__
---------------------------------------

<a name="backend" />

### backend( db, [prefix] )

Creates a backend instance. All backends except Memory require driver or database instance. `useSingle` is only applicable to the MongoDB backend.
@@ -504,7 +521,7 @@ var redisBackend = new acl.redisBackend(client);

Creates a new Redis backend using Redis client `client`.

##Tests
## Tests

Run tests with `npm` (requires mocha):
```javascript
@@ -516,7 +533,7 @@ Run tests with `npm` (requires mocha):
- Support for denials (deny a role a given permission)


##License
## License

(The MIT License)