$ npm i @littlegauze/egg-node-acl --save
// {app_root}/config/plugin.js
exports.nodeAcl = {
enable: true,
package: 'egg-node-acl',
};
// {app_root}/config/config.default.js
exports.nodeAcl = {
client: {
rules: [], // node-acl rules. { roles: [], allows: [] }
hierarchy: [], // node-acl parent map. { parent: 'admin', children: ['blog', 'account'] }
routes: {
prefix: '', // remove the prefix from path
ignore: [], // ignore pattern
match: [], // match pattern, route and resource map. { path: '/user', resource:
},
superAdmin: {
userId: 'userid', // default super admin add to db
roles: [ 'super' ], // default roles grant to user
},
},
insertMdwAt: 0, // node-acl middleware order inset appMiddleware.
};
see config/config.default.js for more detail.
Please open an issue here.