📅  最后修改于: 2022-03-11 15:01:12.895000             🧑  作者: Mango
import { AbilityBuilder } from 'casl'
function subjectName(item) {
if (!item || typeof item === 'string') {
return item
}
return item.__type
}
export default AbilityBuilder.define({ subjectName }, can => {
can(['read', 'create'], 'Todo')
can(['update', 'delete'], 'Todo', { assignee: 'me' })
});