1.0.4 • Published 4 years ago

react-authority-control v1.0.4

Weekly downloads
6
License
MIT
Repository
-
Last release
4 years ago

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