Socket
Book a DemoInstallSign in
Socket

permissions

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

permissions

A package to help people make custom permissions, roles and users

0.1.0
latest
Source
npmnpm
Version published
Weekly downloads
54
-59.4%
Maintainers
1
Weekly downloads
 
Created
Source

Home

About

Permissions is about making managing user permissions easier. You can create your own permissions, roles, users and more are soon to come! Permissions is an easy way to see what user's have access to. You could use integrate this with any NodeJS application! Permissions is also made to be as simple as possible. Check out the examples!

Installation

Installation is easy!

$ npm i permissions

I don't think you needed me for that, though.

Configuration

At the moment you can't configure anything, but it will come soon!

Usage

For advanced usage please visit our documentation. The following is just fo r quick reference.

Declaring Permissions Requirement

const permissions = require('permissions');

Adding Permissions

const permissionsToAdd = ["a", "b"];
const permissionsFile = 'permissions.json';
permissions.savePermissions(permissionsToAdd, permissionsFile);

Adding Users

/*
    DO NOT CONFUSE .newUser(); and new User(); THE LATTER WILL CAUSE ERRORS!!
*/
let userID = "7818"; //id MUST be a string!!
let usersFile = './users.json';
let permissions = ["a", "b"]; //in this case a single * permission will work
let roles = []; //roles are coming soon!!
permissions.newUser(userID, usersFile, permissions, roles);

Loading Permissions/Users

/*
    LOADING PERMISSIONS AND USERS IS CRUCIAL
*/
permissions.loadPermissions(permissionsFile);
permissions.loadUsers(usersFile);

Check for Users Permission to Do X

    // make sure users are loaded!!
    can = permissions.hasPermission(userID, 'a')) //returns true

Keywords

permission

FAQs

Package last updated on 09 Jan 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.