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 is easy!
$ npm i permissions
I don't think you needed me for that, though.
At the moment you can't configure anything, but it will come soon!
For advanced usage please visit our documentation. The following is just fo r quick reference.
const permissions = require('permissions');
const permissionsToAdd = ["a", "b"];
const permissionsFile = 'permissions.json';
permissions.savePermissions(permissionsToAdd, permissionsFile);
/*
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 AND USERS IS CRUCIAL
*/
permissions.loadPermissions(permissionsFile);
permissions.loadUsers(usersFile);
// make sure users are loaded!!
can = permissions.hasPermission(userID, 'a')) //returns true