mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-14 16:13:24 +08:00
Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
ef836acfe9 | |||
a51f0d7c08 |
@ -161,7 +161,7 @@ func (c *ApiController) Signup() {
|
|||||||
username = id
|
username = id
|
||||||
}
|
}
|
||||||
|
|
||||||
initScore, err := getInitScore()
|
initScore, err := getInitScore(organization)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.ResponseError(fmt.Errorf(c.T("account:Get init score failed, error: %w"), err).Error())
|
c.ResponseError(fmt.Errorf(c.T("account:Get init score failed, error: %w"), err).Error())
|
||||||
return
|
return
|
||||||
|
@ -412,7 +412,7 @@ func (c *ApiController) Login() {
|
|||||||
|
|
||||||
properties := map[string]string{}
|
properties := map[string]string{}
|
||||||
properties["no"] = strconv.Itoa(len(object.GetUsers(application.Organization)) + 2)
|
properties["no"] = strconv.Itoa(len(object.GetUsers(application.Organization)) + 2)
|
||||||
initScore, err := getInitScore()
|
initScore, err := getInitScore(organization)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.ResponseError(fmt.Errorf(c.T("auth:Get init score failed, error: %w"), err).Error())
|
c.ResponseError(fmt.Errorf(c.T("auth:Get init score failed, error: %w"), err).Error())
|
||||||
return
|
return
|
||||||
|
@ -119,9 +119,13 @@ func (c *ApiController) RequireAdmin() (string, bool) {
|
|||||||
return user.Owner, true
|
return user.Owner, true
|
||||||
}
|
}
|
||||||
|
|
||||||
func getInitScore() (int, error) {
|
func getInitScore(organization *object.Organization) (int, error) {
|
||||||
|
if organization != nil {
|
||||||
|
return organization.InitScore, nil
|
||||||
|
} else {
|
||||||
return strconv.Atoi(conf.GetConfigString("initScore"))
|
return strconv.Atoi(conf.GetConfigString("initScore"))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (c *ApiController) GetProviderFromContext(category string) (*object.Provider, *object.User, bool) {
|
func (c *ApiController) GetProviderFromContext(category string) (*object.Provider, *object.User, bool) {
|
||||||
providerName := c.Input().Get("provider")
|
providerName := c.Input().Get("provider")
|
||||||
|
@ -59,6 +59,7 @@ func initBuiltInOrganization() bool {
|
|||||||
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", "ja", "ko", "ru"},
|
Languages: []string{"en", "zh", "es", "fr", "de", "ja", "ko", "ru"},
|
||||||
|
InitScore: 2000,
|
||||||
AccountItems: []*AccountItem{
|
AccountItems: []*AccountItem{
|
||||||
{Name: "Organization", Visible: true, ViewRule: "Public", ModifyRule: "Admin"},
|
{Name: "Organization", Visible: true, ViewRule: "Public", ModifyRule: "Admin"},
|
||||||
{Name: "ID", Visible: true, ViewRule: "Public", ModifyRule: "Immutable"},
|
{Name: "ID", Visible: true, ViewRule: "Public", ModifyRule: "Immutable"},
|
||||||
|
@ -47,6 +47,7 @@ type Organization struct {
|
|||||||
Tags []string `xorm:"mediumtext" json:"tags"`
|
Tags []string `xorm:"mediumtext" json:"tags"`
|
||||||
Languages []string `xorm:"varchar(255)" json:"languages"`
|
Languages []string `xorm:"varchar(255)" json:"languages"`
|
||||||
MasterPassword string `xorm:"varchar(100)" json:"masterPassword"`
|
MasterPassword string `xorm:"varchar(100)" json:"masterPassword"`
|
||||||
|
InitScore int `json:"initScore"`
|
||||||
EnableSoftDeletion bool `json:"enableSoftDeletion"`
|
EnableSoftDeletion bool `json:"enableSoftDeletion"`
|
||||||
IsProfilePublic bool `json:"isProfilePublic"`
|
IsProfilePublic bool `json:"isProfilePublic"`
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import {Button, Card, Col, Input, Row, Select, Switch} from "antd";
|
import {Button, Card, Col, Input, InputNumber, Row, Select, Switch} from "antd";
|
||||||
import * as OrganizationBackend from "./backend/OrganizationBackend";
|
import * as OrganizationBackend from "./backend/OrganizationBackend";
|
||||||
import * as ApplicationBackend from "./backend/ApplicationBackend";
|
import * as ApplicationBackend from "./backend/ApplicationBackend";
|
||||||
import * as LdapBackend from "./backend/LdapBackend";
|
import * as LdapBackend from "./backend/LdapBackend";
|
||||||
@ -86,7 +86,6 @@ class OrganizationEditPage extends React.Component {
|
|||||||
|
|
||||||
updateOrganizationField(key, value) {
|
updateOrganizationField(key, value) {
|
||||||
value = this.parseOrganizationField(key, value);
|
value = this.parseOrganizationField(key, value);
|
||||||
|
|
||||||
const organization = this.state.organization;
|
const organization = this.state.organization;
|
||||||
organization[key] = value;
|
organization[key] = value;
|
||||||
this.setState({
|
this.setState({
|
||||||
@ -280,6 +279,16 @@ class OrganizationEditPage extends React.Component {
|
|||||||
</Select>
|
</Select>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
|
<Row style={{marginTop: "20px"}} >
|
||||||
|
<Col style={{marginTop: "5px"}} span={(Setting.isMobile()) ? 19 : 2}>
|
||||||
|
{Setting.getLabel(i18next.t("organization:InitScore"), i18next.t("organization:The user's initScore - Tooltip"))} :
|
||||||
|
</Col>
|
||||||
|
<Col span={4} >
|
||||||
|
<InputNumber value={this.state.organization.initScore} onChange={value => {
|
||||||
|
this.updateOrganizationField("initScore", value);
|
||||||
|
}} />
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
<Row style={{marginTop: "20px"}} >
|
<Row style={{marginTop: "20px"}} >
|
||||||
<Col style={{marginTop: "5px"}} span={(Setting.isMobile()) ? 19 : 2}>
|
<Col style={{marginTop: "5px"}} span={(Setting.isMobile()) ? 19 : 2}>
|
||||||
{Setting.getLabel(i18next.t("organization:Soft deletion"), i18next.t("organization:Soft deletion - Tooltip"))} :
|
{Setting.getLabel(i18next.t("organization:Soft deletion"), i18next.t("organization:Soft deletion - Tooltip"))} :
|
||||||
|
@ -32,16 +32,7 @@ class SelectLanguageBox extends React.Component {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
items = [
|
items = Setting.Countries.map((country) => Setting.getItem(country.label, country.key, flagIcon(country.country, country.alt)));
|
||||||
Setting.getItem("English", "en", flagIcon("US", "English")),
|
|
||||||
Setting.getItem("简体中文", "zh", flagIcon("CN", "简体中文")),
|
|
||||||
Setting.getItem("Español", "es", flagIcon("ES", "Español")),
|
|
||||||
Setting.getItem("Français", "fr", flagIcon("FR", "Français")),
|
|
||||||
Setting.getItem("Deutsch", "de", flagIcon("DE", "Deutsch")),
|
|
||||||
Setting.getItem("日本語", "ja", flagIcon("JP", "日本語")),
|
|
||||||
Setting.getItem("한국어", "ko", flagIcon("KR", "한국어")),
|
|
||||||
Setting.getItem("Русский", "ru", flagIcon("RU", "Русский")),
|
|
||||||
];
|
|
||||||
|
|
||||||
getOrganizationLanguages(languages) {
|
getOrganizationLanguages(languages) {
|
||||||
const select = [];
|
const select = [];
|
||||||
|
@ -33,6 +33,16 @@ export const StaticBaseUrl = "https://cdn.casbin.org";
|
|||||||
// https://catamphetamine.gitlab.io/country-flag-icons/3x2/index.html
|
// https://catamphetamine.gitlab.io/country-flag-icons/3x2/index.html
|
||||||
export const CountryRegionData = getCountryRegionData();
|
export const CountryRegionData = getCountryRegionData();
|
||||||
|
|
||||||
|
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: "Français", key: "fr", country: "FR", alt: "Français"},
|
||||||
|
{label: "Deutsch", key: "de", country: "DE", alt: "Deutsch"},
|
||||||
|
{label: "日本語", key: "ja", country: "JP", alt: "日本語"},
|
||||||
|
{label: "한국어", key: "ko", country: "KR", alt: "한국어"},
|
||||||
|
{label: "Русский", key: "ru", country: "RU", alt: "Русский"},
|
||||||
|
];
|
||||||
|
|
||||||
export const OtherProviderInfo = {
|
export const OtherProviderInfo = {
|
||||||
SMS: {
|
SMS: {
|
||||||
"Aliyun SMS": {
|
"Aliyun SMS": {
|
||||||
|
@ -62,6 +62,7 @@ class UserListPage extends BaseListPage {
|
|||||||
isAdmin: (owner === "built-in"),
|
isAdmin: (owner === "built-in"),
|
||||||
isGlobalAdmin: (owner === "built-in"),
|
isGlobalAdmin: (owner === "built-in"),
|
||||||
IsForbidden: false,
|
IsForbidden: false,
|
||||||
|
score: this.state.organization.initScore,
|
||||||
isDeleted: false,
|
isDeleted: false,
|
||||||
properties: {},
|
properties: {},
|
||||||
signupApplication: "app-built-in",
|
signupApplication: "app-built-in",
|
||||||
|
@ -69,6 +69,12 @@ class LoginPage extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
Setting.Countries.forEach((country) => {
|
||||||
|
new Image().src = `${Setting.StaticBaseUrl}/flag-icons/${country.country}.svg`;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
componentDidUpdate(prevProps, prevState, snapshot) {
|
componentDidUpdate(prevProps, prevState, snapshot) {
|
||||||
if (this.state.application && !prevState.application) {
|
if (this.state.application && !prevState.application) {
|
||||||
const defaultCaptchaProviderItems = this.getDefaultCaptchaProviderItems(this.state.application);
|
const defaultCaptchaProviderItems = this.getDefaultCaptchaProviderItems(this.state.application);
|
||||||
|
@ -330,6 +330,7 @@
|
|||||||
"Default avatar": "Standard Avatar",
|
"Default avatar": "Standard Avatar",
|
||||||
"Edit Organization": "Organisation bearbeiten",
|
"Edit Organization": "Organisation bearbeiten",
|
||||||
"Favicon": "Févicon",
|
"Favicon": "Févicon",
|
||||||
|
"InitScore": "InitScore",
|
||||||
"Is profile public": "Is profile public",
|
"Is profile public": "Is profile public",
|
||||||
"Is profile public - Tooltip": "Is profile public - Tooltip",
|
"Is profile public - Tooltip": "Is profile public - Tooltip",
|
||||||
"Modify rule": "Modify rule",
|
"Modify rule": "Modify rule",
|
||||||
@ -338,6 +339,7 @@
|
|||||||
"Soft deletion - Tooltip": "Weiche Löschung - Tooltip",
|
"Soft deletion - Tooltip": "Weiche Löschung - Tooltip",
|
||||||
"Tags": "Tags",
|
"Tags": "Tags",
|
||||||
"Tags - Tooltip": "Tags - Tooltip",
|
"Tags - Tooltip": "Tags - Tooltip",
|
||||||
|
"The user's initScore - Tooltip": "The user's initScore - Tooltip",
|
||||||
"View rule": "View rule",
|
"View rule": "View rule",
|
||||||
"Visible": "Visible",
|
"Visible": "Visible",
|
||||||
"Website URL": "Website-URL",
|
"Website URL": "Website-URL",
|
||||||
|
@ -330,6 +330,7 @@
|
|||||||
"Default avatar": "Default avatar",
|
"Default avatar": "Default avatar",
|
||||||
"Edit Organization": "Edit Organization",
|
"Edit Organization": "Edit Organization",
|
||||||
"Favicon": "Favicon",
|
"Favicon": "Favicon",
|
||||||
|
"InitScore": "InitScore",
|
||||||
"Is profile public": "Is profile public",
|
"Is profile public": "Is profile public",
|
||||||
"Is profile public - Tooltip": "Is profile public - Tooltip",
|
"Is profile public - Tooltip": "Is profile public - Tooltip",
|
||||||
"Modify rule": "Modify rule",
|
"Modify rule": "Modify rule",
|
||||||
@ -338,6 +339,7 @@
|
|||||||
"Soft deletion - Tooltip": "Soft deletion - Tooltip",
|
"Soft deletion - Tooltip": "Soft deletion - Tooltip",
|
||||||
"Tags": "Tags",
|
"Tags": "Tags",
|
||||||
"Tags - Tooltip": "Tags - Tooltip",
|
"Tags - Tooltip": "Tags - Tooltip",
|
||||||
|
"The user's initScore - Tooltip": "The user's initScore - Tooltip",
|
||||||
"View rule": "View rule",
|
"View rule": "View rule",
|
||||||
"Visible": "Visible",
|
"Visible": "Visible",
|
||||||
"Website URL": "Website URL",
|
"Website URL": "Website URL",
|
||||||
|
@ -330,6 +330,7 @@
|
|||||||
"Default avatar": "Avatar par défaut",
|
"Default avatar": "Avatar par défaut",
|
||||||
"Edit Organization": "Modifier l'organisation",
|
"Edit Organization": "Modifier l'organisation",
|
||||||
"Favicon": "Favicon",
|
"Favicon": "Favicon",
|
||||||
|
"InitScore": "InitScore",
|
||||||
"Is profile public": "Is profile public",
|
"Is profile public": "Is profile public",
|
||||||
"Is profile public - Tooltip": "Is profile public - Tooltip",
|
"Is profile public - Tooltip": "Is profile public - Tooltip",
|
||||||
"Modify rule": "Modify rule",
|
"Modify rule": "Modify rule",
|
||||||
@ -338,6 +339,7 @@
|
|||||||
"Soft deletion - Tooltip": "Suppression de soft - infobulle",
|
"Soft deletion - Tooltip": "Suppression de soft - infobulle",
|
||||||
"Tags": "Tags",
|
"Tags": "Tags",
|
||||||
"Tags - Tooltip": "Tags - Tooltip",
|
"Tags - Tooltip": "Tags - Tooltip",
|
||||||
|
"The user's initScore - Tooltip": "The user's initScore - Tooltip",
|
||||||
"View rule": "View rule",
|
"View rule": "View rule",
|
||||||
"Visible": "Visible",
|
"Visible": "Visible",
|
||||||
"Website URL": "URL du site web",
|
"Website URL": "URL du site web",
|
||||||
|
@ -330,6 +330,7 @@
|
|||||||
"Default avatar": "デフォルトのアバター",
|
"Default avatar": "デフォルトのアバター",
|
||||||
"Edit Organization": "組織を編集",
|
"Edit Organization": "組織を編集",
|
||||||
"Favicon": "ファビコン",
|
"Favicon": "ファビコン",
|
||||||
|
"InitScore": "InitScore",
|
||||||
"Is profile public": "Is profile public",
|
"Is profile public": "Is profile public",
|
||||||
"Is profile public - Tooltip": "Is profile public - Tooltip",
|
"Is profile public - Tooltip": "Is profile public - Tooltip",
|
||||||
"Modify rule": "Modify rule",
|
"Modify rule": "Modify rule",
|
||||||
@ -338,6 +339,7 @@
|
|||||||
"Soft deletion - Tooltip": "ソフト削除 - ツールチップ",
|
"Soft deletion - Tooltip": "ソフト削除 - ツールチップ",
|
||||||
"Tags": "Tags",
|
"Tags": "Tags",
|
||||||
"Tags - Tooltip": "Tags - Tooltip",
|
"Tags - Tooltip": "Tags - Tooltip",
|
||||||
|
"The user's initScore - Tooltip": "The user's initScore - Tooltip",
|
||||||
"View rule": "View rule",
|
"View rule": "View rule",
|
||||||
"Visible": "Visible",
|
"Visible": "Visible",
|
||||||
"Website URL": "Website URL",
|
"Website URL": "Website URL",
|
||||||
|
@ -330,6 +330,7 @@
|
|||||||
"Default avatar": "Default avatar",
|
"Default avatar": "Default avatar",
|
||||||
"Edit Organization": "Edit Organization",
|
"Edit Organization": "Edit Organization",
|
||||||
"Favicon": "Favicon",
|
"Favicon": "Favicon",
|
||||||
|
"InitScore": "InitScore",
|
||||||
"Is profile public": "Is profile public",
|
"Is profile public": "Is profile public",
|
||||||
"Is profile public - Tooltip": "Is profile public - Tooltip",
|
"Is profile public - Tooltip": "Is profile public - Tooltip",
|
||||||
"Modify rule": "Modify rule",
|
"Modify rule": "Modify rule",
|
||||||
@ -338,6 +339,7 @@
|
|||||||
"Soft deletion - Tooltip": "Soft deletion - Tooltip",
|
"Soft deletion - Tooltip": "Soft deletion - Tooltip",
|
||||||
"Tags": "Tags",
|
"Tags": "Tags",
|
||||||
"Tags - Tooltip": "Tags - Tooltip",
|
"Tags - Tooltip": "Tags - Tooltip",
|
||||||
|
"The user's initScore - Tooltip": "The user's initScore - Tooltip",
|
||||||
"View rule": "View rule",
|
"View rule": "View rule",
|
||||||
"Visible": "Visible",
|
"Visible": "Visible",
|
||||||
"Website URL": "Website URL",
|
"Website URL": "Website URL",
|
||||||
|
@ -330,6 +330,7 @@
|
|||||||
"Default avatar": "Аватар по умолчанию",
|
"Default avatar": "Аватар по умолчанию",
|
||||||
"Edit Organization": "Изменить организацию",
|
"Edit Organization": "Изменить организацию",
|
||||||
"Favicon": "Иконка",
|
"Favicon": "Иконка",
|
||||||
|
"InitScore": "InitScore",
|
||||||
"Is profile public": "Is profile public",
|
"Is profile public": "Is profile public",
|
||||||
"Is profile public - Tooltip": "Is profile public - Tooltip",
|
"Is profile public - Tooltip": "Is profile public - Tooltip",
|
||||||
"Modify rule": "Modify rule",
|
"Modify rule": "Modify rule",
|
||||||
@ -338,6 +339,7 @@
|
|||||||
"Soft deletion - Tooltip": "Мягкое удаление - Подсказка",
|
"Soft deletion - Tooltip": "Мягкое удаление - Подсказка",
|
||||||
"Tags": "Tags",
|
"Tags": "Tags",
|
||||||
"Tags - Tooltip": "Tags - Tooltip",
|
"Tags - Tooltip": "Tags - Tooltip",
|
||||||
|
"The user's initScore - Tooltip": "The user's initScore - Tooltip",
|
||||||
"View rule": "View rule",
|
"View rule": "View rule",
|
||||||
"Visible": "Visible",
|
"Visible": "Visible",
|
||||||
"Website URL": "URL сайта",
|
"Website URL": "URL сайта",
|
||||||
|
@ -330,6 +330,7 @@
|
|||||||
"Default avatar": "默认头像",
|
"Default avatar": "默认头像",
|
||||||
"Edit Organization": "编辑组织",
|
"Edit Organization": "编辑组织",
|
||||||
"Favicon": "图标",
|
"Favicon": "图标",
|
||||||
|
"InitScore": "初始积分",
|
||||||
"Is profile public": "用户个人页公开",
|
"Is profile public": "用户个人页公开",
|
||||||
"Is profile public - Tooltip": "关闭后,只有全局管理员或同组织用户才能访问用户主页",
|
"Is profile public - Tooltip": "关闭后,只有全局管理员或同组织用户才能访问用户主页",
|
||||||
"Modify rule": "修改规则",
|
"Modify rule": "修改规则",
|
||||||
@ -338,6 +339,7 @@
|
|||||||
"Soft deletion - Tooltip": "启用后,删除用户信息时不会在数据库彻底清除,只会标记为已删除状态",
|
"Soft deletion - Tooltip": "启用后,删除用户信息时不会在数据库彻底清除,只会标记为已删除状态",
|
||||||
"Tags": "标签集合",
|
"Tags": "标签集合",
|
||||||
"Tags - Tooltip": "可供用户选择的标签的集合",
|
"Tags - Tooltip": "可供用户选择的标签的集合",
|
||||||
|
"The user's initScore - Tooltip": "用户的初始积分",
|
||||||
"View rule": "查看规则",
|
"View rule": "查看规则",
|
||||||
"Visible": "是否可见",
|
"Visible": "是否可见",
|
||||||
"Website URL": "网页地址",
|
"Website URL": "网页地址",
|
||||||
|
Reference in New Issue
Block a user