Zum Hauptinhalt springen

Database syncer

The database syncer connects to an external database and syncs user data into Casdoor. A demo users table can be imported from the template XLSX.

Tabelle

Create a syncer​

Go to Syncers and create a new syncer with the following. Save when done.

bearbeiten

Tipp

Fill at least ID and Name in the Casdoor column mapping. Other useful fields include createdTime, Password, and DisplayName.

Erforderliche Felder​

FeldBeschreibung
OrganisationOrganization to import users into.
BezeichnungSyncer name.
Typdatabase.
Host, Port, User, PasswordSource database connection.
DatenbanktypMySQL, PostgreSQL, SQL Server, Oracle, or SQLite (Xorm-supported).
DatenbankSource database name.
TabelleSource user table name.
TabellenspaltenColumn name (source), Column type (source), Casdoor Column (Casdoor user field).

Optionale Felder​

FeldBeschreibung
ist gehashtIf enabled, sync runs only when fields included in the hash change; other field-only changes do not trigger sync.
Ist SchlüsselMarks the primary key used to match source and Casdoor users. At least one column must be key; if none is set, the first is used.
Avatar-Basis-URLIf set and source user.avatar does not start with http, Casdoor stores Avatar base URL + user.avatar.
ZuordnungstabelleTable used to sync user affiliation. Int codes can be mapped to names; see getAffiliationMap() and syncer_util (e.g. score for int→string mapping).

Enable Is enable and save; the syncer will run. You can also trigger a sync with the Sync button.

Benutzer

Aktualisieren​

With Table columns configured for key mapping, differences on the key between source and Casdoor trigger updates:

  • Update in source table — changes sync to Casdoor.

  • Update in Casdoor — changes sync back to source.

Hinzufügen​

When row counts differ, the syncer adds rows to the table with fewer rows, using the key to match:

  • Add user in source table:

  • Add user in Casdoor table: