littleGauze / egg-node-acl

egg plugin for acl manage

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

License:MIT License


Languages

Language:JavaScript 100.0%