π Vue Roles & Permissions (ACL) β [ Laravel+ Rails] β 0devco
npm i @0devco/v-permit
# yarn
yarn add @0devco/v-permit
import Vpermit from '@0devco/v-permit';
Vue.use(Vpermit);
<template lang="html">
<div class="">
<div class="" v-permit="hasAllPermission('a1','edit-post','delete-post') || v_permit.a1">
<h1>done! all permission exist </h1>
</div>
<div v-permit="hasAllPermission('b43','edit-post','delete-post','create-user') || v_permit.b43">
<h1>don't have create user permissions </h1>
</div>
<div v-permit="hasAnyPermission('c21','edit-post','delete-post','create-user') || v_permit.c21">
<h1>don't have create user permissions but hasAnyPermission exists </h1>
</div>
</div>
</template>
<script>
import permitMixins from '@0devco/v-permit/mixins/permit'
export default {
data () {
return {
msg: 'v-permit',
// json format
authPermissionURI: "https://raw.githubusercontent.com/0devco/v-permit/master/authUserPermissions.json"
}
},
mixins: [permitMixins]
}
</script>
<style lang="css" scoped >
</style>
~ v-permit="hasAnyPermission('c21'
,'edit-post','delete-post','create-user') || v_permit.c21
"
- first element is check id (ex
c21
) - check id will be
unique
- you can use check id (
a1 β a50
,b1 β b50
,c1 β c50
,d1 β d50
,e1 β e50
)