跳到主内容

数据库

数据库同步器

我们作为演示创建的用户表从 模板 XLSX 文件 导入。

表格

点击 Syncers 标签页并创建一个新的同步器。 填写下面所需的所有信息并保存。

编辑

提示

一般而言,您至少需要填写Casdoor列中的 IDName 以及其他重要信息,如 createdTime, Password, DisplayName.

The following are the required fields.

  • Organization: The organization that the user will import
  • Name: The syncer name
  • Type: Select database
  • Host: The original database host
  • Port: The original database port
  • User: The original database username
  • Password: The original database password
  • Database type: All Xorm supported databases, like: MySQL, PostgreSQL, SQL Server, Oracle, Sqlite
  • Database: The original database name
  • Table: The original user table name
  • 表格列
  • Column name: The original user column name
  • Column type: The original user column type
  • Casdoor Column: The casdoor user column name

Optional fields

  • Is hashed: Whether to calculate hash value. When enable "Is hashed", if the field of user in origin table updated, the syncer will sync this user. Disable "Is hashed", meaning if only the field update, the syncer need not sync the user. In short, the user does not synchronize until the fields involved in the hash calculation(enable "Is hashed") are updated.
  • Avatar base URL: When sync users, if Avatar base URL is not empty and origin user.avatar not hasPrefix "http", new user.avatar will be replaced by Avatar base URL + user.avatar.
  • Affiliation table: It is used to sync the affiliation of user from this table in database. Because the affiliation may be code of int type in "Affiliation table", so we need to map the int to a string. See getAffiliationMap() . Because Casdoor has some redundant fields to borrow, here we use score to map the int code to a string name.

然后您可以打开 启用 按钮并保存,同步器将开始工作。

用户