apier-permissioner

Defines if the user that makes the request can access the service

Usage no npm install needed!

<script type="module">
  import apierPermissioner from 'https://cdn.skypack.dev/apier-permissioner';
</script>

README

apier-permissioner Build Status

Part of the apier framework

Defines if the user that makes the request can access the service
Uses the user making the request (req.activeUser) to check if the user can access the specified service.
To define the permissions you can use either an array or a string as explained below
NOTICE: Admin users can access all services.

User types (Array)

An array with the user types that can access the service. Using ['null'] means its a public service.
e.g.: ['editor', 'client']

Expression (String)

An expression that will be evaluated e.g.: "id === 'self' && type === 'client'"
The variables that are available for the expression are "type" for the userType and "id" for the request uuid.

Installation

Download node at nodejs.org and install it, if you haven't already.

npm install apier-permissioner --save

Dependencies

Dev Dependencies

License

MIT

Generated by package-json-to-readme