数据库
数据库同步器
我们作为演示创建的用户表从 模板 XLSX 文件 导入。
点击 Syncers 标签页并创建一个新的同步器。 填写下面所需的所有信息并保存。
提示
一般而言,您至少需要填写Casdoor列中的 ID
和 Name
以及其他重要信息,如 createdTime
, Password
, DisplayName
.
The following are the required fields.
Organization
: The organization that the user will importName
: The syncer nameType
: Select databaseHost
: The original database hostPort
: The original database portUser
: The original database usernamePassword
: The original database passwordDatabase type
: All Xorm supported databases, like: MySQL, PostgreSQL, SQL Server, Oracle, SqliteDatabase
: The original database nameTable
: The original user table name表格列
Column name
: The original user column nameColumn type
: The original user column typeCasdoor 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 usescore
to map the int code to a string name.
然后您可以打开 启用 按钮并保存,同步器将开始工作。