This package has been deprecated

    Author message:

    this package has been deprecated see https://npmjs.com/package/permissions.js

    permissions

    0.1.0 • Public • Published

    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

    Install

    npm i permissions

    DownloadsWeekly Downloads

    67

    Version

    0.1.0

    License

    MPL-2.0

    Unpacked Size

    5.01 kB

    Total Files

    3

    Last publish

    Collaborators

    • danielnewell