Use cases and boundaries
Use it when API, menu and Mongo data rules need to resolve from the same role assignments. A connected MonSQLize instance persists roles, bindings and audit state. Evaluate permissions with a trusted subject and a known tenant; the application still authenticates requests and chooses which business resource they target.
Getting started and compatibility
Install the released package
npm install permission-core@3.0.4 monsqlize@3.1.0
Published 3.0.4 documents MonSQLize 3.1.0 and Node.js 18+ for the core. Its optional Vext adapter declares Vext 0.3.26 and requires Node.js 20.19+. The default branch identifies itself as 4.0.0 and declares different peers. The example reads permissions from an existing MonSQLize connection. In tenant acme, the check returns true if u-1 has an effective invoke grant for api:GET:/api/orders through a role binding. With no effective grant, it returns false. 3.0.4 role and binding setup
import { PermissionCore } from 'permission-core';
// msq is the host's connected MonSQLize 3.1 instance.
const permissions = new PermissionCore({ monsqlize: msq });
await permissions.init();
const subject = permissions.forSubject({ userId: 'u-1', scope: { tenantId: 'acme' } });
console.log(await subject.can('invoke', 'api:GET:/api/orders'));
await permissions.close();