# smallorange-acl

> Reactive ACL's based on RxJS

Latest version **1.1.16** (published 2018-10-03) · ISC license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install smallorange-acl
pnpm add smallorange-acl
yarn add smallorange-acl
bun add smallorange-acl
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.1.16 |
| Published | 2018-10-03 |
| First published | 2017-01-27 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 41.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Felipe Rohde |
| Maintainers | feliperohde |

## Links

- npm: https://www.npmjs.com/package/smallorange-acl
- Repository: https://github.com/feliperohdee/smallorange-acl
- Homepage: https://smallorange.co
- Issues: https://github.com/feliperohdee/smallorange-acl/issues
- npm.io page: https://npm.io/package/smallorange-acl

## Dependencies (2)

- [rxjs](https://npm.io/package/rxjs.md) ^5.5.2
- [lodash](https://npm.io/package/lodash.md) ^4.17.4

## Recent versions

- 1.1.16 (latest) — 2018-10-03
- 1.1.15 — 2018-09-26
- 1.1.14 — 2018-05-11
- 1.1.13 — 2018-05-11
- 1.1.12 — 2018-01-18
- 1.1.11 — 2018-01-18
- 1.1.10 — 2018-01-12
- 1.1.9 — 2018-01-12
- 1.1.8 — 2018-01-12
- 1.1.7 — 2017-11-01
- 1.1.6 — 2017-11-01
- 1.1.5 — 2017-11-01
- 1.1.4 — 2017-11-01
- 1.1.3 — 2017-04-13
- 1.1.2 — 2017-04-09
- … 7 more at https://npm.io/package/smallorange-acl/versions

## README

[![CircleCI](https://circleci.com/gh/feliperohdee/smallorange-acl.svg?style=svg)](https://circleci.com/gh/feliperohdee/smallorange-acl)

# Small Orange ACL

Reactive ACL's based on RxJS

## Usage

		const Acl = require('smallorange-acl');
		const = new Model();

		const mockedArgs = {
			id: 'someId',
			select: ['id', 'name', 'password'],
			limit: 100
		};

		const mockedAuth = {
			namespace: 'someNamespace',
			role: 'admin',
			id: 'someId'
		};

		const aclRules = {
			// context, method or operation
			fetch: {
				// roles
				public: {
					expression: (args, auth, context) => {
						// ensure auth.id
						if(!auth.id){
							return false;	
						}
						
						// can return an Observable, confirming user existence for example
						return context.model.get(auth.id)
								.map(response => !!response);
					}
				},
				admin: true // grant free access,
				unpredictable: false // block all access
			}
		};

		const acl = new Acl(aclRules, {
			model
		});
		
		acl.execute.fetch(mockedArgs, mockedAuth, {
					rejectSilently: boolean,
					onReject: function
				})
				.mergeMap(aclargs => model.fetch(aclargs))
				.subscribe(nextFn, errFn);

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