react-authority-control
v1.0.4
Published
Authority condition validator library for React Js
Downloads
7
Readme
react-authority-control
Validating authority conditions in react application
Installation
$ npm install react-authority-control
Development
Usage 1:
import Authority from 'react-authority-control';
<Authority module={} permission={} privileges={}>
Your Component...
</Authority>
Example 1:
import Authority from 'react-authority-control';
<Authority module={"COMPANY"} permission={"CREATE"} privileges={["COMPANY:CREATE", "COMPANY:UPDATE", "COMPANY:DELETE"]}>
Your Component...
</Authority>
Usage 2:
import {hasPermission} from 'react-authority-control';
if(hasPermission(module, permission, privileges)) {
your code...
}
Example 2:
import {hasPermission} from 'react-authority-control';
if(hasPermission("COMPANY", "CREATE", ["COMPANY:CREATE", "COMPANY:UPDATE", "COMPANY:DELETE"])) {
your code...
}
License
MIT