AccessControl casbin MemoryAdapter
I'm following tutorial from this https://refine.dev/docs/advanced-tutorials/access-control/#adding-policy-and-model
However, in Adding Policy and Model.
Where does the MemoryAdapter come from?
Access Control | refine
Introduction
6 Replies
Hi @tads8799. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
I'm sorry for the confusion, but it seems there's a mistake in the documentation you're following. The
MemoryAdapter
should be imported from the "casbin" library, similar to how the newModel
function is imported. However, this import statement is not shown in the provided extracts.
I recommend checking the official Casbin documentation or their GitHub repository for the correct usage and import statements.
----------------------
Note: you can ask me a follow up question by @ mentioning me again
:speech_balloon:
----------------------<@577213996344803338> kapa.ai is still learning and improving, please let us know how it did by reacting below
ambitious-aqua•13mo ago
The full example code is like this:
@kapa.ai
Let me check the knowledge base for you. One moment! :books:
----------------------
The
MemoryAdapter
in your code is used to define the policy for the Casbin enforcer. It seems like there's a mistake in your code. You've imported StringAdapter
from "casbin" but you're using MemoryAdapter
which is not imported.
If you want to use MemoryAdapter
, you should import it from "casbin". If MemoryAdapter
is not available in "casbin", you might want to use StringAdapter
instead, as you've already imported it.
Here's how your code should look like if you want to use StringAdapter
:
Please check the official Casbin documentation for the correct usage and import statements.
----------------------
Note: you can ask me a follow up question by @ mentioning me again
:speech_balloon:
----------------------<@577213996344803338> kapa.ai is still learning and improving, please let us know how it did by reacting below
ambitious-aqua•13mo ago
I understand