Skip to content

littleGauze/egg-node-acl

Repository files navigation

egg-node-acl

NPM version build status Test coverage David deps Known Vulnerabilities npm download

Install

$ npm i @littlegauze/egg-node-acl --save

Usage

// {app_root}/config/plugin.js
exports.nodeAcl = {
  enable: true,
  package: 'egg-node-acl',
};

Configuration

// {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.

Example

Questions & Suggestions

Please open an issue here.

License

MIT

About

egg plugin for acl manage

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published