session-role-manager
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

session-role-manager

NPM version NPM download Release

Session Role Manager is the Session-based role manager for node-casbin. With this library, node-casbin can load session-based role hierarchy (user-role mapping) from Casbin policy or save role hierarchy to it. The session is only active in the specified time range.

Installation

# Yarn 
yarn add session-role-manager
# NPM 
npm install session-role-manager --save

Example

import { newEnforcer } from 'casbin';
import { SessionRoleManager } from 'session-role-manager';
 
async function app() {
  const e = await newEnforcer('examples/rbac_model_with_sessions.conf', 'examples/rbac_policy_with_sessions.csv');
 
  // Use our role manager.
  const rm = new SessionRoleManager(10);
  e.setRoleManager(rm);
  await e.buildRoleLinks();
}
 
app();

/session-role-manager/

    Package Sidebar

    Install

    npm i session-role-manager

    Homepage

    casbin.org/

    Weekly Downloads

    224

    Version

    0.0.2

    License

    Apache-2.0

    Unpacked Size

    25.2 kB

    Total Files

    16

    Last publish

    Collaborators

    • nodece