node package manager
Easy sharing. Manage teams and permissions with one click. Create a free org »

auth-role

auth-role

Create named collections of permissions.

Installation

Node

npm install auth-role

Browser

component install alexmingoia/auth-role

Example

var Permission = require('auth-permission');
var Role = require('auth-role');
 
var role = new Role('member');
 
role
  .allow(Permission('read', 'forum'))
  .allow(Permission('create', 'thread'));

API

Role(name)

Create a new Role with given name.

role.allow(permission)

Allow given permission.

role.name()

Return the name of the role.

role.permissions()

Return the role's allowed permissions.

MIT Licensed