use-accesscontrol-grants
v1.0.0
Published
Authorize roles using accesscontrol grants
Downloads
1
Readme
use-accesscontrol-grants
Easily authorize roles based on accesscontrol grants.
Usage
import useGrants from 'use-accesscontrol-grants';
const canAccess = useGrants(YOUR_GRANTS_LIST);
const canUserAccess = canAccess('user');
const canAdminAccess = canAccess('admin');
if (canUserAccess('video', 'read', 'any')) {
console.log('user can view any video');
}
if (canAdminAccess('video', 'read', 'any')) {
console.log('admin can view any video');
}
Happy coding!