1.0.3 • Published 4 years ago

@littlegauze/egg-node-acl v1.0.3

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

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

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago