@mertsolak/permission-manager
v1.2.1
Published
Developed for permission management using hexadecimal numbers with typescript support
Downloads
4
Readme
Permission Manager
Developed for permission management using hexadecimal numbers with typescript support
Installation
Use node package manager to install @mertsolak/permission-manager.
npm i @mertsolak/permission-manager
Basic Usage
import { Permissions, createPermissionNames } from '@mertsolak/permission-manager';
const permissionNames = createPermissionNames('login', 'logout', 'profile', 'settings');
const initialPermissionNumber = '0x0'; // this is optional, default is 0x0;
const permissions = new Permissions(permissionNames, initialPermissionNumber);
permission.addPermissions(['login', 'logout']); // adds login and logout as permissions
permission.removePermissions(['login']); // removes login from the permissions if it exists
permission.verifyPermissions(['login', 'logout'], '&'); // verifies permissions with '&' operator. default operator is '|'.