0.0.3 • Published 11 months ago

@rs-poly/permissions v0.0.3

Weekly downloads
-
License
ISC
Repository
-
Last release
11 months ago

intro

The permission model should be similar to the following structure:

{
  "permissions": {
    "Users": [
      "create",
      "read",
      "update",
      "delete"
    ],
    ... //any permission you want defined
    ,
    "Courses:Flows": [
      "create",
      "read",
      "update",
      "delete",
      "assign"
    ]
  }
}

The mentioned values should be stored in Vuex, and you need to provide the path to access that key. Please specify the permissionKey to access the permissions in Vuex.

quick start

import permissionPlugin from '@rs-poly/permissions'
Vue.use(permissionPlugin, {
  permissionKey: 'user.pc_userInfo',
  store
})

You can use the v-poly-permission:read="'Users'" format to use it.

Advanced

The following method can check if you have access permissions for the resource.

Vue.checkRoutes(subject)

You can use the following method to check for access permissions on a page after Vue has been instantiated.

this.$checkRoutes(subject)

You can also use the following method to check access permissions for a specific resource.

Vue.prototype.$ability.can(actions, subject)

You can use the following method to unsubscribe the listener.

this.$unsubscribePermission()
0.0.3

11 months ago

0.0.2

11 months ago

0.0.1

11 months ago