2.3.3 • Published 7 years ago

policy-decision-point v2.3.3

Weekly downloads
2
License
ISC
Repository
github
Last release
7 years ago

PolicyDecisionPoint

Intended for educational purposes only

Introduction

This policy decision point respects access control based on roles and their hierarchies.

Install

$ npm install --save policy-decision-point

Usage

Requires a config file which has to be json.

Ex:

{
    "UA": {},
    "PA": {},
    "RH": {}
}

For more specific example, see test/model.json

    const pdpFactory = require('policy-decision-point')
    
    pdpFactory.init('pathOfFile', (err, pdp) => {
       
       //
       pdp.resetSession()
       
       // Login your user if exists in file/json and grants access to roles
       pdp.login(user, roles)
       
       // Returns all roles that a user can access 
       pdp.userRoles(user)
       
       // Grants a set of roles if user is logged and are represented in file/json
       pdp.grantRoles(user, roles)
       
       // Revokes a set of roles if user is logged and are represented in file/json
       pdp.revokeRoles(user, roles)
       
       // Logs out the user
       pdp.logout(user)
       
       // Checks if user has such permission
       pdp.isPermitted(user, permission)
    })
    
    const pdp = pdpFactory.initSync('pathOfFile')
     
    const pdp = pdpFactory.initWithJson({
         "UA": {},
         "PA": {},
         "RH": {}
    })
2.3.3

7 years ago

2.2.3

7 years ago

2.1.3

7 years ago

2.1.2

7 years ago

2.0.2

7 years ago

2.0.1

7 years ago

2.0.0

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago