victorybiz / vue-simple-acl

A simple unopinionated Vue plugin for managing user roles and permissions, access-control list (ACL) and role-based access control (RBAC).
https://github.com/victorybiz/vue-simple-acl
131 stars 24 forks source link

`.disable` modifier not applying to some components #13

Open Dylancyclone opened 1 year ago

Dylancyclone commented 1 year ago

First of all thank you for making this package, it has been a great help in organizing permissions.

I am using version 2.0.2

I've noticed that using the .disable modifier on a permission directive causes some components to not become disabled when that permission is not held. The component will still disappear with without the .disable modifier, as expected.

The expected behavior is that the the "disable" prop should be applied to the component when the given permission is not met and the .disable modifier is present.

The actual behavior is that not all components receive this prop, even though it is a valid prop that can be applied to the component.

A workaround I have found is to explicitly set "disable" or "disabled" prop using the helper function "$acl.role()", though looking at the code, that should be what the directive is doing anyways https://github.com/victorybiz/vue-simple-acl/blob/016178c2bc958b1fab47cf8395138f65801f7fa7/src/VueSimpleAcl.ts#L345-L346

Is there something I am doing wrong?

Reproduction Link: https://codesandbox.io/s/modest-matsumoto-6ions3?file=/src/pages/Index.vue:2304-2345 chrome_BUwnPZPb9z