Hi All, I am trying to use casbin in combination with refine as documented here: https://refine.dev/docs/advanced-tutorials/access-control/#introduction
However, I am getting the following error in my app:
at index.js:19:11```
I dont' have any Buffer or any piece of code that uses Buffer in my app, so it must be something to do with casbin because it throws this error when I run the following code:
accessControlProvider={{
can: async ({ resource, action, params }) => {
const enforcer = await newEnforcer(model, adapter);
if (!role) {
return { can: false, reason: "No role found" };
}
if (action === "delete" action === "edit" action === "show") {
if (role == "admin") {
const can = await enforcer.enforce(role, ${resource}/${params?.id}, action);
return { can };
} else if (role == "manager") {
if (!orgId) {
return { can: false, reason: "No organization id found" };
}
const can = await enforcer.enforce(role, organizations/${orgId}/${resource}/${params?.id}, action);
return { can };
}
}
const can = await enforcer.enforce(role, resource, action);
return { can };
},
}}
I imported `newEnforcer` like this; seems to work fine because its fully typed after importing.
`import { newEnforcer } from "casbin";`
I am using React + Vite for my frontend; does anyone know why this could be happening?
Thanks!
