Socket
Book a DemoInstallSign in
Socket

policy-decision-point

Package Overview
Dependencies
Maintainers
2
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

policy-decision-point

Policy Decision Point for access control authentication based on roles and hierarchies

latest
Source
npmnpm
Version
2.3.3
Version published
Maintainers
2
Created
Source

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": {}
    })

FAQs

Package last updated on 13 Jan 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts