mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-04 21:30:24 +08:00
feat: support user migration from Keycloak using syncer (#645)
* feat: support user migration from Keycloak using syncer Signed-off-by: Yixiang Zhao <seriouszyx@foxmail.com> * feat: add more Keycloak columns Signed-off-by: Yixiang Zhao <seriouszyx@foxmail.com> * fix: requested changes Signed-off-by: Yixiang Zhao <seriouszyx@foxmail.com>
This commit is contained in:
@ -155,7 +155,7 @@ class OrganizationEditPage extends React.Component {
|
||||
<Col span={22} >
|
||||
<Select virtual={false} style={{width: '100%'}} value={this.state.organization.passwordType} onChange={(value => {this.updateOrganizationField('passwordType', value);})}>
|
||||
{
|
||||
['plain', 'salt', 'md5-salt', 'bcrypt']
|
||||
['plain', 'salt', 'md5-salt', 'bcrypt', 'pbkdf2-salt']
|
||||
.map((item, index) => <Option key={index} value={item}>{item}</Option>)
|
||||
}
|
||||
</Select>
|
||||
|
@ -654,3 +654,94 @@ export function getFromLink() {
|
||||
}
|
||||
return from;
|
||||
}
|
||||
|
||||
export function getSyncerTableColumns(syncer) {
|
||||
switch (syncer.type) {
|
||||
case "Keycloak":
|
||||
return [
|
||||
{
|
||||
"name":"ID",
|
||||
"type":"string",
|
||||
"casdoorName":"Id",
|
||||
"isHashed":true,
|
||||
"values":[
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name":"USERNAME",
|
||||
"type":"string",
|
||||
"casdoorName":"Name",
|
||||
"isHashed":true,
|
||||
"values":[
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name":"USERNAME",
|
||||
"type":"string",
|
||||
"casdoorName":"DisplayName",
|
||||
"isHashed":true,
|
||||
"values":[
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name":"EMAIL",
|
||||
"type":"string",
|
||||
"casdoorName":"Email",
|
||||
"isHashed":true,
|
||||
"values":[
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name":"EMAIL_VERIFIED",
|
||||
"type":"boolean",
|
||||
"casdoorName":"EmailVerified",
|
||||
"isHashed":true,
|
||||
"values":[
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name":"FIRST_NAME",
|
||||
"type":"string",
|
||||
"casdoorName":"FirstName",
|
||||
"isHashed":true,
|
||||
"values":[
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name":"LAST_NAME",
|
||||
"type":"string",
|
||||
"casdoorName":"LastName",
|
||||
"isHashed":true,
|
||||
"values":[
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name":"CREATED_TIMESTAMP",
|
||||
"type":"string",
|
||||
"casdoorName":"CreatedTime",
|
||||
"isHashed":true,
|
||||
"values":[
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name":"ENABLED",
|
||||
"type":"boolean",
|
||||
"casdoorName":"IsForbidden",
|
||||
"isHashed":true,
|
||||
"values":[
|
||||
|
||||
]
|
||||
}
|
||||
]
|
||||
default:
|
||||
return []
|
||||
}
|
||||
}
|
@ -117,9 +117,13 @@ class SyncerEditPage extends React.Component {
|
||||
{Setting.getLabel(i18next.t("provider:Type"), i18next.t("provider:Type - Tooltip"))} :
|
||||
</Col>
|
||||
<Col span={22} >
|
||||
<Select virtual={false} style={{width: '100%'}} value={this.state.syncer.type} onChange={(value => {this.updateSyncerField('type', value);})}>
|
||||
<Select virtual={false} style={{width: '100%'}} value={this.state.syncer.type} onChange={(value => {
|
||||
this.updateSyncerField('type', value);
|
||||
this.state.syncer["tableColumns"] = Setting.getSyncerTableColumns(this.state.syncer);
|
||||
this.state.syncer.table = value === "Keycloak" ? "user_entity" : this.state.syncer.table;
|
||||
})}>
|
||||
{
|
||||
['Database', 'LDAP']
|
||||
['Database', 'LDAP', 'Keycloak']
|
||||
.map((item, index) => <Option key={index} value={item}>{item}</Option>)
|
||||
}
|
||||
</Select>
|
||||
@ -198,7 +202,8 @@ class SyncerEditPage extends React.Component {
|
||||
{Setting.getLabel(i18next.t("syncer:Table"), i18next.t("syncer:Table - Tooltip"))} :
|
||||
</Col>
|
||||
<Col span={22} >
|
||||
<Input value={this.state.syncer.table} onChange={e => {
|
||||
<Input value={this.state.syncer.table}
|
||||
disabled={this.state.syncer.type === "Keycloak"} onChange={e => {
|
||||
this.updateSyncerField('table', e.target.value);
|
||||
}} />
|
||||
</Col>
|
||||
|
@ -98,9 +98,9 @@ class SyncerTableColumnTable extends React.Component {
|
||||
return (
|
||||
<Select virtual={false} style={{width: '100%'}} value={text} onChange={(value => {this.updateField(table, index, 'casdoorName', value);})}>
|
||||
{
|
||||
['Name', 'CreatedTime', 'UpdatedTime', 'Id', 'Type', 'Password', 'PasswordSalt', 'DisplayName', 'Avatar', 'PermanentAvatar', 'Email', 'Phone',
|
||||
'Location', 'Address', 'Affiliation', 'Title', 'IdCardType', 'IdCard', 'Homepage', 'Bio', 'Tag', 'Region', 'Language', 'Gender', 'Birthday',
|
||||
'Education', 'Score', 'Ranking', 'IsDefaultAvatar', 'IsOnline', 'IsAdmin', 'IsGlobalAdmin', 'IsForbidden', 'IsDeleted', 'CreatedIp']
|
||||
['Name', 'CreatedTime', 'UpdatedTime', 'Id', 'Type', 'Password', 'PasswordSalt', 'DisplayName', 'FirstName', 'LastName', 'Avatar', 'PermanentAvatar',
|
||||
'Email', 'EmailVerified', 'Phone', 'Location', 'Address', 'Affiliation', 'Title', 'IdCardType', 'IdCard', 'Homepage', 'Bio', 'Tag', 'Region',
|
||||
'Language', 'Gender', 'Birthday', 'Education', 'Score', 'Ranking', 'IsDefaultAvatar', 'IsOnline', 'IsAdmin', 'IsGlobalAdmin', 'IsForbidden', 'IsDeleted', 'CreatedIp']
|
||||
.map((item, index) => <Option key={index} value={item}>{item}</Option>)
|
||||
}
|
||||
</Select>
|
||||
|
Reference in New Issue
Block a user