Database
Database Syncer
The users table we created as a demo are imported from the template XLSX file.
Click the Syncers tab and create a new syncer. Fill in all the required information as below and save.
tip
In general, you need to fill in at least the ID
and Name
in Casdoor Columns. And others important fields like 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 nameTable columns
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.
Then you can turn on the Is enable button and save, the syncer will start to work.