chore(release): 0.1.0 [skip ci] # [0.1.0](https://github.com/node-casbin/session-role-manager/compare/v0.0.2...v0.1.0) (2026-02-02) ### Bug Fixes * Changed string to Date for SessionRole time. ([3d995de](https://github.com/node-casbin/session-role-manager/commit/3d995defabd94c1dbddcd1f42fe7b1cb3b411ba2)) ### Features * add CI semantic-release for npm and GitHub ([#6](https://github.com/node-casbin/session-role-manager/issues/6)) ([2464c1a](https://github.com/node-casbin/session-role-manager/commit/2464c1a6d1d30f77a7e55865678a2c9d1760f131)) * modernize CI workflow and README, fix the code ([3a63d70](https://github.com/node-casbin/session-role-manager/commit/3a63d70d8cadbd91210d75f5a061146ba30b7aaf))
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.
npm install session-role-manager
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();