mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-02 11:20:18 +08:00
Refactor the code
This commit is contained in:
@ -93,7 +93,7 @@ func initBuiltInOrganization() bool {
|
|||||||
Favicon: fmt.Sprintf("%s/img/casbin/favicon.ico", conf.GetConfigString("staticBaseUrl")),
|
Favicon: fmt.Sprintf("%s/img/casbin/favicon.ico", conf.GetConfigString("staticBaseUrl")),
|
||||||
PasswordType: "plain",
|
PasswordType: "plain",
|
||||||
PasswordOptions: []string{"AtLeast6"},
|
PasswordOptions: []string{"AtLeast6"},
|
||||||
CountryCodes: []string{"US", "ES", "CN", "FR", "DE", "GB", "JP", "KR", "VN", "ID", "SG", "IN"},
|
CountryCodes: []string{"US", "ES", "FR", "DE", "GB", "CN", "JP", "KR", "VN", "ID", "SG", "IN"},
|
||||||
DefaultAvatar: fmt.Sprintf("%s/img/casbin.svg", conf.GetConfigString("staticBaseUrl")),
|
DefaultAvatar: fmt.Sprintf("%s/img/casbin.svg", conf.GetConfigString("staticBaseUrl")),
|
||||||
Tags: []string{},
|
Tags: []string{},
|
||||||
Languages: []string{"en", "zh", "es", "fr", "de", "id", "ja", "ko", "ru", "vi", "pt"},
|
Languages: []string{"en", "zh", "es", "fr", "de", "id", "ja", "ko", "ru", "vi", "pt"},
|
||||||
@ -130,7 +130,7 @@ func initBuiltInUser() {
|
|||||||
Avatar: fmt.Sprintf("%s/img/casbin.svg", conf.GetConfigString("staticBaseUrl")),
|
Avatar: fmt.Sprintf("%s/img/casbin.svg", conf.GetConfigString("staticBaseUrl")),
|
||||||
Email: "admin@example.com",
|
Email: "admin@example.com",
|
||||||
Phone: "12345678910",
|
Phone: "12345678910",
|
||||||
CountryCode: "CN",
|
CountryCode: "US",
|
||||||
Address: []string{},
|
Address: []string{},
|
||||||
Affiliation: "Example Inc.",
|
Affiliation: "Example Inc.",
|
||||||
Tag: "staff",
|
Tag: "staff",
|
||||||
|
@ -69,7 +69,7 @@ type Organization struct {
|
|||||||
IsProfilePublic bool `json:"isProfilePublic"`
|
IsProfilePublic bool `json:"isProfilePublic"`
|
||||||
|
|
||||||
MfaItems []*MfaItem `xorm:"varchar(300)" json:"mfaItems"`
|
MfaItems []*MfaItem `xorm:"varchar(300)" json:"mfaItems"`
|
||||||
AccountItems []*AccountItem `xorm:"varchar(3000)" json:"accountItems"`
|
AccountItems []*AccountItem `xorm:"varchar(5000)" json:"accountItems"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetOrganizationCount(owner, field, value string) (int64, error) {
|
func GetOrganizationCount(owner, field, value string) (int64, error) {
|
||||||
|
@ -35,7 +35,7 @@ class OrganizationListPage extends BaseListPage {
|
|||||||
passwordType: "plain",
|
passwordType: "plain",
|
||||||
PasswordSalt: "",
|
PasswordSalt: "",
|
||||||
passwordOptions: [],
|
passwordOptions: [],
|
||||||
countryCodes: ["CN"],
|
countryCodes: ["US"],
|
||||||
defaultAvatar: `${Setting.StaticBaseUrl}/img/casbin.svg`,
|
defaultAvatar: `${Setting.StaticBaseUrl}/img/casbin.svg`,
|
||||||
defaultApplication: "",
|
defaultApplication: "",
|
||||||
tags: [],
|
tags: [],
|
||||||
@ -53,25 +53,40 @@ class OrganizationListPage extends BaseListPage {
|
|||||||
{name: "Password", visible: true, viewRule: "Self", modifyRule: "Self"},
|
{name: "Password", visible: true, viewRule: "Self", modifyRule: "Self"},
|
||||||
{name: "Email", visible: true, viewRule: "Public", modifyRule: "Self"},
|
{name: "Email", visible: true, viewRule: "Public", modifyRule: "Self"},
|
||||||
{name: "Phone", visible: true, viewRule: "Public", modifyRule: "Self"},
|
{name: "Phone", visible: true, viewRule: "Public", modifyRule: "Self"},
|
||||||
|
{name: "Country code", visible: true, viewRule: "Public", modifyRule: "Self"},
|
||||||
{name: "Country/Region", visible: true, viewRule: "Public", modifyRule: "Self"},
|
{name: "Country/Region", visible: true, viewRule: "Public", modifyRule: "Self"},
|
||||||
{name: "Location", visible: true, viewRule: "Public", modifyRule: "Self"},
|
{name: "Location", visible: true, viewRule: "Public", modifyRule: "Self"},
|
||||||
|
{name: "Address", visible: true, viewRule: "Public", modifyRule: "Self"},
|
||||||
{name: "Affiliation", visible: true, viewRule: "Public", modifyRule: "Self"},
|
{name: "Affiliation", visible: true, viewRule: "Public", modifyRule: "Self"},
|
||||||
{name: "Title", visible: true, viewRule: "Public", modifyRule: "Self"},
|
{name: "Title", visible: true, viewRule: "Public", modifyRule: "Self"},
|
||||||
|
{name: "ID card type", visible: true, viewRule: "Public", modifyRule: "Self"},
|
||||||
|
{name: "ID card", visible: true, viewRule: "Public", modifyRule: "Self"},
|
||||||
|
{name: "ID card info", visible: true, viewRule: "Public", modifyRule: "Self"},
|
||||||
{name: "Homepage", visible: true, viewRule: "Public", modifyRule: "Self"},
|
{name: "Homepage", visible: true, viewRule: "Public", modifyRule: "Self"},
|
||||||
{name: "Bio", visible: true, viewRule: "Public", modifyRule: "Self"},
|
{name: "Bio", visible: true, viewRule: "Public", modifyRule: "Self"},
|
||||||
{name: "Tag", visible: true, viewRule: "Public", modifyRule: "Admin"},
|
{name: "Tag", visible: true, viewRule: "Public", modifyRule: "Admin"},
|
||||||
|
{name: "Language", visible: true, viewRule: "Public", modifyRule: "Admin"},
|
||||||
|
{name: "Gender", visible: true, viewRule: "Public", modifyRule: "Admin"},
|
||||||
|
{name: "Birthday", visible: true, viewRule: "Public", modifyRule: "Admin"},
|
||||||
|
{name: "Education", visible: true, viewRule: "Public", modifyRule: "Admin"},
|
||||||
|
{name: "Score", visible: true, viewRule: "Public", modifyRule: "Admin"},
|
||||||
|
{name: "Karma", visible: true, viewRule: "Public", modifyRule: "Admin"},
|
||||||
|
{name: "Ranking", visible: true, viewRule: "Public", modifyRule: "Admin"},
|
||||||
{name: "Signup application", visible: true, viewRule: "Public", modifyRule: "Admin"},
|
{name: "Signup application", visible: true, viewRule: "Public", modifyRule: "Admin"},
|
||||||
{name: "API key", label: i18next.t("general:API key")},
|
{name: "API key", label: i18next.t("general:API key"), modifyRule: "Self"},
|
||||||
|
{name: "Groups", visible: true, viewRule: "Public", modifyRule: "Immutable"},
|
||||||
{name: "Roles", visible: true, viewRule: "Public", modifyRule: "Immutable"},
|
{name: "Roles", visible: true, viewRule: "Public", modifyRule: "Immutable"},
|
||||||
{name: "Permissions", visible: true, viewRule: "Public", modifyRule: "Immutable"},
|
{name: "Permissions", visible: true, viewRule: "Public", modifyRule: "Immutable"},
|
||||||
{name: "Groups", visible: true, viewRule: "Public", modifyRule: "Immutable"},
|
|
||||||
{name: "3rd-party logins", visible: true, viewRule: "Self", modifyRule: "Self"},
|
{name: "3rd-party logins", visible: true, viewRule: "Self", modifyRule: "Self"},
|
||||||
{Name: "Multi-factor authentication", Visible: true, ViewRule: "Self", ModifyRule: "Self"},
|
|
||||||
{name: "Properties", visible: false, viewRule: "Admin", modifyRule: "Admin"},
|
{name: "Properties", visible: false, viewRule: "Admin", modifyRule: "Admin"},
|
||||||
|
{name: "Is online", visible: true, viewRule: "Admin", modifyRule: "Admin"},
|
||||||
{name: "Is admin", visible: true, viewRule: "Admin", modifyRule: "Admin"},
|
{name: "Is admin", visible: true, viewRule: "Admin", modifyRule: "Admin"},
|
||||||
{name: "Is global admin", visible: true, viewRule: "Admin", modifyRule: "Admin"},
|
{name: "Is global admin", visible: true, viewRule: "Admin", modifyRule: "Admin"},
|
||||||
{name: "Is forbidden", visible: true, viewRule: "Admin", modifyRule: "Admin"},
|
{name: "Is forbidden", visible: true, viewRule: "Admin", modifyRule: "Admin"},
|
||||||
{name: "Is deleted", visible: true, viewRule: "Admin", modifyRule: "Admin"},
|
{name: "Is deleted", visible: true, viewRule: "Admin", modifyRule: "Admin"},
|
||||||
|
{Name: "Multi-factor authentication", Visible: true, ViewRule: "Self", ModifyRule: "Self"},
|
||||||
|
{Name: "WebAuthn credentials", Visible: true, ViewRule: "Self", ModifyRule: "Self"},
|
||||||
|
{Name: "Managed accounts", Visible: true, ViewRule: "Self", ModifyRule: "Self"},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -34,10 +34,10 @@ export const ServerUrl = "";
|
|||||||
export const StaticBaseUrl = "https://cdn.casbin.org";
|
export const StaticBaseUrl = "https://cdn.casbin.org";
|
||||||
|
|
||||||
export const Countries = [{label: "English", key: "en", country: "US", alt: "English"},
|
export const Countries = [{label: "English", key: "en", country: "US", alt: "English"},
|
||||||
{label: "中文", key: "zh", country: "CN", alt: "中文"},
|
|
||||||
{label: "Español", key: "es", country: "ES", alt: "Español"},
|
{label: "Español", key: "es", country: "ES", alt: "Español"},
|
||||||
{label: "Français", key: "fr", country: "FR", alt: "Français"},
|
{label: "Français", key: "fr", country: "FR", alt: "Français"},
|
||||||
{label: "Deutsch", key: "de", country: "DE", alt: "Deutsch"},
|
{label: "Deutsch", key: "de", country: "DE", alt: "Deutsch"},
|
||||||
|
{label: "中文", key: "zh", country: "CN", alt: "中文"},
|
||||||
{label: "Indonesia", key: "id", country: "ID", alt: "Indonesia"},
|
{label: "Indonesia", key: "id", country: "ID", alt: "Indonesia"},
|
||||||
{label: "日本語", key: "ja", country: "JP", alt: "日本語"},
|
{label: "日本語", key: "ja", country: "JP", alt: "日本語"},
|
||||||
{label: "한국어", key: "ko", country: "KR", alt: "한국어"},
|
{label: "한국어", key: "ko", country: "KR", alt: "한국어"},
|
||||||
|
@ -54,7 +54,6 @@ class UserEditPage extends React.Component {
|
|||||||
loading: true,
|
loading: true,
|
||||||
returnUrl: null,
|
returnUrl: null,
|
||||||
idCardInfo: ["ID card front", "ID card back", "ID card with person"],
|
idCardInfo: ["ID card front", "ID card back", "ID card with person"],
|
||||||
idCardKey: ["idCardFront", "idCardBack", "idCardWithPerson"],
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -553,9 +552,12 @@ class UserEditPage extends React.Component {
|
|||||||
{i18next.t("general:Preview")}:
|
{i18next.t("general:Preview")}:
|
||||||
</Col>
|
</Col>
|
||||||
{
|
{
|
||||||
this.state.idCardInfo.map((key, index) => {
|
[
|
||||||
const newKey = this.state.idCardKey[index];
|
{name: "ID card front", value: "idCardFront"},
|
||||||
return this.renderImage(this.state.user.properties[newKey] || "", this.getIdCardType(key), this.getIdCardText(key), newKey, disabled);
|
{name: "ID card back", value: "idCardBack"},
|
||||||
|
{name: "ID card with person", value: "idCardWithPerson"},
|
||||||
|
].map((entry) => {
|
||||||
|
return this.renderImage(this.state.user.properties[entry.value] || "", this.getIdCardType(entry.name), this.getIdCardText(entry.name), entry.value, disabled);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
</Row>
|
</Row>
|
||||||
@ -1014,7 +1016,7 @@ class UserEditPage extends React.Component {
|
|||||||
} else if (key === "ID card with person") {
|
} else if (key === "ID card with person") {
|
||||||
return i18next.t("user:ID card with person");
|
return i18next.t("user:ID card with person");
|
||||||
} else {
|
} else {
|
||||||
return "Unknown Id card type";
|
return "Unknown Id card name: " + key;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1026,7 +1028,7 @@ class UserEditPage extends React.Component {
|
|||||||
} else if (key === "ID card with person") {
|
} else if (key === "ID card with person") {
|
||||||
return i18next.t("user:Upload ID card with person picture");
|
return i18next.t("user:Upload ID card with person picture");
|
||||||
} else {
|
} else {
|
||||||
return "Unknown Id card text";
|
return "Unknown Id card name: " + key;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,6 +80,7 @@ class AccountTable extends React.Component {
|
|||||||
{name: "Title", label: i18next.t("user:Title")},
|
{name: "Title", label: i18next.t("user:Title")},
|
||||||
{name: "ID card type", label: i18next.t("user:ID card type")},
|
{name: "ID card type", label: i18next.t("user:ID card type")},
|
||||||
{name: "ID card", label: i18next.t("user:ID card")},
|
{name: "ID card", label: i18next.t("user:ID card")},
|
||||||
|
{name: "ID card info", label: i18next.t("user:ID card info")},
|
||||||
{name: "Homepage", label: i18next.t("user:Homepage")},
|
{name: "Homepage", label: i18next.t("user:Homepage")},
|
||||||
{name: "Bio", label: i18next.t("user:Bio")},
|
{name: "Bio", label: i18next.t("user:Bio")},
|
||||||
{name: "Tag", label: i18next.t("user:Tag")},
|
{name: "Tag", label: i18next.t("user:Tag")},
|
||||||
@ -92,9 +93,9 @@ class AccountTable extends React.Component {
|
|||||||
{name: "Ranking", label: i18next.t("user:Ranking")},
|
{name: "Ranking", label: i18next.t("user:Ranking")},
|
||||||
{name: "Signup application", label: i18next.t("general:Signup application")},
|
{name: "Signup application", label: i18next.t("general:Signup application")},
|
||||||
{name: "API key", label: i18next.t("general:API key")},
|
{name: "API key", label: i18next.t("general:API key")},
|
||||||
|
{name: "Groups", label: i18next.t("general:Groups")},
|
||||||
{name: "Roles", label: i18next.t("general:Roles")},
|
{name: "Roles", label: i18next.t("general:Roles")},
|
||||||
{name: "Permissions", label: i18next.t("general:Permissions")},
|
{name: "Permissions", label: i18next.t("general:Permissions")},
|
||||||
{name: "Groups", label: i18next.t("general:Groups")},
|
|
||||||
{name: "3rd-party logins", label: i18next.t("user:3rd-party logins")},
|
{name: "3rd-party logins", label: i18next.t("user:3rd-party logins")},
|
||||||
{name: "Properties", label: i18next.t("user:Properties")},
|
{name: "Properties", label: i18next.t("user:Properties")},
|
||||||
{name: "Is online", label: i18next.t("user:Is online")},
|
{name: "Is online", label: i18next.t("user:Is online")},
|
||||||
|
Reference in New Issue
Block a user