Closed ChampIsMe closed 3 years ago
From the docs it seems to be an in memory data set check the Readme.md
Fast. (Grants are stored in memory, no database queries.)
You can persist your grants in database and pass grants to AccessControl constructor as an array fetched from DB like so:
// grant list fetched from DB (to be converted to a valid grants object, internally)
let grantList = [ { role: 'admin', resource: 'video', action: 'create:any', attributes: ', !views' }, { role: 'admin', resource: 'video', action: 'read:any', attributes: '' }, { role: 'admin', resource: 'video', action: 'update:any', attributes: ', !views' }, { role: 'admin', resource: 'video', action: 'delete:any', attributes: '' }, { role: 'user', resource: 'video', action: 'create:own', attributes: ', !rating, !views' }, { role: 'user', resource: 'video', action: 'read:any', attributes: '' }, { role: 'user', resource: 'video', action: 'update:own', attributes: ', !rating, !views' }, { role: 'user', resource: 'video', action: 'delete:own', attributes: '' } ];
const ac = new AccessControl(grantList);
Hello @onury ,Great work here. I want to use this in production and I am requesting to know how the library persists data please.