My CASL implementation is quite basic and I've noticed that the documentation lacks detail. The code I'm using is essentially a copy-paste from the docs:
import { abilitiesPlugin } from '@casl/vue'
import defineAbilitiesFor from './ability'
const ability = defineAbilitiesFor({name: 'guest'})
Vue.use(abilitiesPlugin, ability )
The function defineAbilitiesFor
is defined in the file ./ability.js as follows:
import { AbilityBuilder } from '@casl/ability'
function defineAbilitiesFor(user) {
return AbilityBuilder.define((can, cannot) => {
can(['read'], 'foo', { username: user.name})
})
}
I am aware of how to update rules or conditions with ability.update([])
. However, my question is: How can I update a user's information after initializing CASL? For example, after the user logs in.