跳到主内容

适配器

In Casbin, an adapter is the layer that loads and saves policy rules (e.g. to a database). Casdoor lets you configure an adapter in the UI and run basic CRUD on policies.

Adapter configuration

  • Type — Adapter type (currently database only).
  • Host, Port, User, Password — Database connection.
  • Database type — MySQL, PostgreSQL, SQL Server, Oracle, or SQLite 3.
  • Database — Database name.
  • Table — Table name (created if it does not exist).

适配器配置

信息

After saving the adapter config, click Sync to load policies into the table below.

适配器策略

CRUD on policies

Once the adapter is connected, you can add, edit, and delete policy rows in the UI.

Add — One policy at a time. New rows appear at the top in the UI but are stored at the end; after the next sync they show in the correct order.

适配器添加

Edit适配器编辑

Delete适配器删除