permiso
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

Permiso

Dot notation permissions helper with optional simple obfuscation. Permiso uses an object map, typically based on a folder structure. Permiso then allows you to use dot notation to build up a permissions path in a controlled way to ensure it matches the permissions map you have supplied.

Additionally you can use obfuscation which obscures, albeit insecurely the actual path to the permission. Essentially making it more difficult to exploit when used on the client side of your application. It is important to understand this is more or less a deterrent. This is because your server/api is the ultimate arbiter.

NOTICE

Work in progress until version 1.x

Installation

$ npm install permiso -s

OR

$ yarn add permiso

Getting Started

Consider the following map. Image a directory structure as follows:

/user /user/profile

/admin /admin/users

/common /common/login /common/reset

import permiso from 'permiso';
 
const obj = {
 
  anonymous: 'anonymous',
  authenticated: 'authenticated',
 
  user: {
    profile: 'profile' // value can be anything.
  },
  
  admin: {
    users: 'users' // such as a list etc.
  },
 
  common: {
    login: 'login',
    reset: 'reset'
  }
 
};
 
const 

Package Sidebar

Install

npm i permiso

Weekly Downloads

0

Version

0.1.0

License

ISC

Unpacked Size

585 kB

Total Files

61

Last publish

Collaborators

  • blujedis