# policy-decision-point

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

Latest version **2.3.3** (published 2017-01-13) · ISC license · 0 weekly downloads

## Install

```sh
npm install policy-decision-point
pnpm add policy-decision-point
yarn add policy-decision-point
bun add policy-decision-point
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.3.3 |
| Published | 2017-01-13 |
| First published | 2016-12-20 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | iamfreee, no0law1 |

## Links

- npm: https://www.npmjs.com/package/policy-decision-point
- Repository: https://github.com/no0law1/PolicyDecisionPoint
- Homepage: https://github.com/no0law1/PolicyDecisionPoint#readme
- Issues: https://github.com/no0law1/PolicyDecisionPoint/issues
- npm.io page: https://npm.io/package/policy-decision-point

## Recent versions

- 2.3.3 (latest) — 2017-01-13
- 1.0.0 (beta) — 2016-12-20
- 2.2.3 — 2017-01-06
- 2.1.3 — 2017-01-03
- 2.1.2 — 2017-01-02
- 2.0.2 — 2016-12-30
- 2.0.1 — 2016-12-28
- 2.0.0 — 2016-12-28
- 1.0.2 — 2016-12-20
- 1.0.1 — 2016-12-20

## README

# 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:**
```json
{
    "UA": {},
    "PA": {},
    "RH": {}
}
```

For more specific example, see test/model.json

```js
    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": {}
    })
```

---
_Source: https://npm.io/package/policy-decision-point · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
