-
I'm finding some of the documentation confusing. For example: import { createApp } from 'vue';
import { abilitiesPlugin } from '@casl/vue';
import ability from './services/ability';
createApp()
.use(abilitiesPlugin, ability, {
useGlobalProperties: true
})
.mount('#app'); But this approach is not possible in I'd say most cases, where a user has to log in, and the Vue app has already been created and set up. I figure this should work in a very top-level Vue component: setup() {
const myCustomAbility = defineAbility((can) => {
// ...
});
provideAbility(myCustomAbility)
} But it's odd that the documentation says:
Am I going about this the wrong way? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Start with empty ability and then update permissions via check examples for more details - https://github.com/stalniy/casl-examples/tree/master/packages/vue-blog |
Beta Was this translation helpful? Give feedback.
Start with empty ability and then update permissions via
ability.update
. The doc says about providing different Ability instance. No point to provide different just update singleton object. 1 Ability per appcheck examples for more details - https://github.com/stalniy/casl-examples/tree/master/packages/vue-blog