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

Directives are not working #4

Closed felocru closed 2 years ago

felocru commented 2 years ago

Hi, thanks for this great tool. None of the directives I put in are working. I put some example:

<div v-can:operador  v-role:operador   class="test">
</div>

My rule:

setRule('operador', user => {
          debugger;
          return false;
        });

I put a debugger inside the rule to see if execution stops, but to no avail. However, if it stops when I do: this.$acl.role("operador") or this.$can('operador')

Am I missing something to configure?

EdvaldoLima commented 1 year ago

@felocru did you manage to come up with a solution? If I'm not misunderstood the documentation, the snippet:

<button v-role:admin>Create Post</button>

will show the button only to an admin user. But that doesn't work, I'm in the same situation as you reading the documentation carefully. The directives exist, but the rule is not being applied.