# vue-role-acl

> Vue role permission manager

Latest version **0.3.0** (published 2020-05-19) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install vue-role-acl
pnpm add vue-role-acl
yarn add vue-role-acl
bun add vue-role-acl
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.0 |
| Published | 2020-05-19 |
| First published | 2020-05-18 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 17.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | eyasliu |
| Keywords | vue, acl, role, permission |

## Links

- npm: https://www.npmjs.com/package/vue-role-acl
- Repository: https://github.com/eyasliu/vue-role-acl
- Homepage: https://github.com/eyasliu/vue-role-acl#readme
- Issues: https://github.com/eyasliu/vue-role-acl/issues
- npm.io page: https://npm.io/package/vue-role-acl

## Recent versions

- 0.3.0 (latest) — 2020-05-19
- 0.2.1 — 2020-05-18
- 0.2.0 — 2020-05-18
- 0.1.0 — 2020-05-18
- 0.0.2 — 2020-05-18
- 0.0.1 — 2020-05-18

## README

# Vue Role Acl 权限管理

vue 的权限管理中间件

## Usage

```html
<p v-if="$acl.check('read')">user can read</p>
<p v-if="$acl.check('edit')">user can edit</p>
<p v-if="$acl.check('delete')">user can delete</p>
<p v-if="$acl.check('list')">user can list</p>
<p v-if="$acl.check('read', 'list')">user can read or list</p>
```

```js
const router = new VueRouter({
  routes: [
    { path: '/read', component: { template: '<p>read</p>' }, meta: { rule: ['read'] } },
    { path: '/edit', component: { template: '<p>edit</p>' }, meta: { rule: ['edit'] } },
    { path: '/delete', component: { template: '<p>delete</p>' }, meta: { rule: ['delete'] } },
    { path: '/list', component: { template: '<p>list</p>' }, meta: { rule: ['list'] } },
    { path: '/public', component: { template: '<p>public</p>' } },
    { path: '/not-found', component: { template: '<p>not-found</p>' } },
  ]
})

Vue.use(VueRoleAcl, {
  initial: 'public',
  router,
  notfound: '/not-found',
  rules: {
    '*': ['read'],
    admin: '*',
    login: ['read', 'list'],
    editor: ['read', 'list', 'edit', 'delete'],
  },
})
```

---
_Source: https://npm.io/package/vue-role-acl · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
