mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-04 05:10:19 +08:00
Add tags to organization.
This commit is contained in:
@ -18,6 +18,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/casdoor/casdoor/object"
|
"github.com/casdoor/casdoor/object"
|
||||||
"github.com/casdoor/casdoor/util"
|
"github.com/casdoor/casdoor/util"
|
||||||
@ -172,6 +173,13 @@ func (c *ApiController) Signup() {
|
|||||||
Karma: 0,
|
Karma: 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(organization.Tags) > 0 {
|
||||||
|
tokens := strings.Split(organization.Tags[0], "|")
|
||||||
|
if len(tokens) > 0 {
|
||||||
|
user.Tag = tokens[0]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if application.GetSignupItemRule("Display name") == "First, last" {
|
if application.GetSignupItemRule("Display name") == "First, last" {
|
||||||
if form.FirstName != "" || form.LastName != "" {
|
if form.FirstName != "" || form.LastName != "" {
|
||||||
user.DisplayName = fmt.Sprintf("%s %s", form.FirstName, form.LastName)
|
user.DisplayName = fmt.Sprintf("%s %s", form.FirstName, form.LastName)
|
||||||
|
@ -47,9 +47,10 @@ func initBuiltInOrganization() {
|
|||||||
DisplayName: "Built-in Organization",
|
DisplayName: "Built-in Organization",
|
||||||
WebsiteUrl: "https://example.com",
|
WebsiteUrl: "https://example.com",
|
||||||
Favicon: "https://cdn.casbin.com/static/favicon.ico",
|
Favicon: "https://cdn.casbin.com/static/favicon.ico",
|
||||||
|
PasswordType: "plain",
|
||||||
PhonePrefix: "86",
|
PhonePrefix: "86",
|
||||||
DefaultAvatar: "https://casbin.org/img/casbin.svg",
|
DefaultAvatar: "https://casbin.org/img/casbin.svg",
|
||||||
PasswordType: "plain",
|
Tags: []string{},
|
||||||
}
|
}
|
||||||
AddOrganization(organization)
|
AddOrganization(organization)
|
||||||
}
|
}
|
||||||
|
@ -25,15 +25,16 @@ type Organization struct {
|
|||||||
Name string `xorm:"varchar(100) notnull pk" json:"name"`
|
Name string `xorm:"varchar(100) notnull pk" json:"name"`
|
||||||
CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
|
CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
|
||||||
|
|
||||||
DisplayName string `xorm:"varchar(100)" json:"displayName"`
|
DisplayName string `xorm:"varchar(100)" json:"displayName"`
|
||||||
WebsiteUrl string `xorm:"varchar(100)" json:"websiteUrl"`
|
WebsiteUrl string `xorm:"varchar(100)" json:"websiteUrl"`
|
||||||
Favicon string `xorm:"varchar(100)" json:"favicon"`
|
Favicon string `xorm:"varchar(100)" json:"favicon"`
|
||||||
PasswordType string `xorm:"varchar(100)" json:"passwordType"`
|
PasswordType string `xorm:"varchar(100)" json:"passwordType"`
|
||||||
PasswordSalt string `xorm:"varchar(100)" json:"passwordSalt"`
|
PasswordSalt string `xorm:"varchar(100)" json:"passwordSalt"`
|
||||||
PhonePrefix string `xorm:"varchar(10)" json:"phonePrefix"`
|
PhonePrefix string `xorm:"varchar(10)" json:"phonePrefix"`
|
||||||
DefaultAvatar string `xorm:"varchar(100)" json:"defaultAvatar"`
|
DefaultAvatar string `xorm:"varchar(100)" json:"defaultAvatar"`
|
||||||
MasterPassword string `xorm:"varchar(100)" json:"masterPassword"`
|
Tags []string `xorm:"mediumtext" json:"tags"`
|
||||||
EnableSoftDeletion bool `json:"enableSoftDeletion"`
|
MasterPassword string `xorm:"varchar(100)" json:"masterPassword"`
|
||||||
|
EnableSoftDeletion bool `json:"enableSoftDeletion"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetOrganizationCount(owner, field, value string) int {
|
func GetOrganizationCount(owner, field, value string) int {
|
||||||
|
@ -208,6 +208,18 @@ class OrganizationEditPage extends React.Component {
|
|||||||
</Row>
|
</Row>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
|
<Row style={{marginTop: '20px'}} >
|
||||||
|
<Col style={{marginTop: '5px'}} span={(Setting.isMobile()) ? 22 : 2}>
|
||||||
|
{Setting.getLabel(i18next.t("organization:Tags"), i18next.t("organization:Tags - Tooltip"))} :
|
||||||
|
</Col>
|
||||||
|
<Col span={22} >
|
||||||
|
<Select virtual={false} mode="tags" style={{width: '100%'}} value={this.state.organization.tags} onChange={(value => {this.updateOrganizationField('tags', value);})}>
|
||||||
|
{
|
||||||
|
this.state.organization.tags?.map((item, index) => <Option key={index} value={item}>{item}</Option>)
|
||||||
|
}
|
||||||
|
</Select>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
<Row style={{marginTop: '20px'}} >
|
<Row style={{marginTop: '20px'}} >
|
||||||
<Col style={{marginTop: '5px'}} span={(Setting.isMobile()) ? 22 : 2}>
|
<Col style={{marginTop: '5px'}} span={(Setting.isMobile()) ? 22 : 2}>
|
||||||
{Setting.getLabel(i18next.t("general:Master password"), i18next.t("general:Master password - Tooltip"))} :
|
{Setting.getLabel(i18next.t("general:Master password"), i18next.t("general:Master password - Tooltip"))} :
|
||||||
|
@ -36,6 +36,7 @@ class OrganizationListPage extends BaseListPage {
|
|||||||
PasswordSalt: "",
|
PasswordSalt: "",
|
||||||
phonePrefix: "86",
|
phonePrefix: "86",
|
||||||
defaultAvatar: "https://casbin.org/img/casbin.svg",
|
defaultAvatar: "https://casbin.org/img/casbin.svg",
|
||||||
|
tags: [],
|
||||||
masterPassword: "",
|
masterPassword: "",
|
||||||
enableSoftDeletion: false,
|
enableSoftDeletion: false,
|
||||||
}
|
}
|
||||||
|
@ -301,9 +301,24 @@ class UserEditPage extends React.Component {
|
|||||||
{Setting.getLabel(i18next.t("user:Tag"), i18next.t("user:Tag - Tooltip"))} :
|
{Setting.getLabel(i18next.t("user:Tag"), i18next.t("user:Tag - Tooltip"))} :
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={22} >
|
<Col span={22} >
|
||||||
<Input value={this.state.user.tag} onChange={e => {
|
{
|
||||||
this.updateUserField('tag', e.target.value);
|
this.state.application?.organizationObj.tags?.length > 0 ? (
|
||||||
}} />
|
<Select virtual={false} style={{width: '100%'}} value={this.state.user.tag} onChange={(value => {this.updateUserField('tag', value);})}>
|
||||||
|
{
|
||||||
|
this.state.application.organizationObj.tags?.map((tag, index) => {
|
||||||
|
const tokens = tag.split("|");
|
||||||
|
const value = tokens[0];
|
||||||
|
const displayValue = Setting.getLanguage() !== "zh" ? tokens[0] : tokens[1];
|
||||||
|
return <Option key={index} value={value}>{displayValue}</Option>
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</Select>
|
||||||
|
) : (
|
||||||
|
<Input value={this.state.user.tag} onChange={e => {
|
||||||
|
this.updateUserField('tag', e.target.value);
|
||||||
|
}} />
|
||||||
|
)
|
||||||
|
}
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
<Row style={{marginTop: '20px'}} >
|
<Row style={{marginTop: '20px'}} >
|
||||||
|
@ -249,6 +249,8 @@
|
|||||||
"New Organization": "New Organization",
|
"New Organization": "New Organization",
|
||||||
"Soft deletion": "Weiche Löschung",
|
"Soft deletion": "Weiche Löschung",
|
||||||
"Soft deletion - Tooltip": "Weiche Löschung - Tooltip",
|
"Soft deletion - Tooltip": "Weiche Löschung - Tooltip",
|
||||||
|
"Tags": "Tags",
|
||||||
|
"Tags - Tooltip": "Tags - Tooltip",
|
||||||
"Website URL": "Website-URL",
|
"Website URL": "Website-URL",
|
||||||
"Website URL - Tooltip": "Unique string-style identifier"
|
"Website URL - Tooltip": "Unique string-style identifier"
|
||||||
},
|
},
|
||||||
|
@ -249,6 +249,8 @@
|
|||||||
"New Organization": "New Organization",
|
"New Organization": "New Organization",
|
||||||
"Soft deletion": "Soft deletion",
|
"Soft deletion": "Soft deletion",
|
||||||
"Soft deletion - Tooltip": "Soft deletion - Tooltip",
|
"Soft deletion - Tooltip": "Soft deletion - Tooltip",
|
||||||
|
"Tags": "Tags",
|
||||||
|
"Tags - Tooltip": "Tags - Tooltip",
|
||||||
"Website URL": "Website URL",
|
"Website URL": "Website URL",
|
||||||
"Website URL - Tooltip": "Website URL - Tooltip"
|
"Website URL - Tooltip": "Website URL - Tooltip"
|
||||||
},
|
},
|
||||||
|
@ -249,6 +249,8 @@
|
|||||||
"New Organization": "New Organization",
|
"New Organization": "New Organization",
|
||||||
"Soft deletion": "Suppression du logiciel",
|
"Soft deletion": "Suppression du logiciel",
|
||||||
"Soft deletion - Tooltip": "Suppression de soft - infobulle",
|
"Soft deletion - Tooltip": "Suppression de soft - infobulle",
|
||||||
|
"Tags": "Tags",
|
||||||
|
"Tags - Tooltip": "Tags - Tooltip",
|
||||||
"Website URL": "URL du site web",
|
"Website URL": "URL du site web",
|
||||||
"Website URL - Tooltip": "Unique string-style identifier"
|
"Website URL - Tooltip": "Unique string-style identifier"
|
||||||
},
|
},
|
||||||
|
@ -249,6 +249,8 @@
|
|||||||
"New Organization": "New Organization",
|
"New Organization": "New Organization",
|
||||||
"Soft deletion": "ソフト削除",
|
"Soft deletion": "ソフト削除",
|
||||||
"Soft deletion - Tooltip": "ソフト削除 - ツールチップ",
|
"Soft deletion - Tooltip": "ソフト削除 - ツールチップ",
|
||||||
|
"Tags": "Tags",
|
||||||
|
"Tags - Tooltip": "Tags - Tooltip",
|
||||||
"Website URL": "Website URL",
|
"Website URL": "Website URL",
|
||||||
"Website URL - Tooltip": "Unique string-style identifier"
|
"Website URL - Tooltip": "Unique string-style identifier"
|
||||||
},
|
},
|
||||||
|
@ -249,6 +249,8 @@
|
|||||||
"New Organization": "New Organization",
|
"New Organization": "New Organization",
|
||||||
"Soft deletion": "Soft deletion",
|
"Soft deletion": "Soft deletion",
|
||||||
"Soft deletion - Tooltip": "Soft deletion - Tooltip",
|
"Soft deletion - Tooltip": "Soft deletion - Tooltip",
|
||||||
|
"Tags": "Tags",
|
||||||
|
"Tags - Tooltip": "Tags - Tooltip",
|
||||||
"Website URL": "Website URL",
|
"Website URL": "Website URL",
|
||||||
"Website URL - Tooltip": "Unique string-style identifier"
|
"Website URL - Tooltip": "Unique string-style identifier"
|
||||||
},
|
},
|
||||||
|
@ -249,6 +249,8 @@
|
|||||||
"New Organization": "New Organization",
|
"New Organization": "New Organization",
|
||||||
"Soft deletion": "Мягкое удаление",
|
"Soft deletion": "Мягкое удаление",
|
||||||
"Soft deletion - Tooltip": "Мягкое удаление - Подсказка",
|
"Soft deletion - Tooltip": "Мягкое удаление - Подсказка",
|
||||||
|
"Tags": "Tags",
|
||||||
|
"Tags - Tooltip": "Tags - Tooltip",
|
||||||
"Website URL": "URL сайта",
|
"Website URL": "URL сайта",
|
||||||
"Website URL - Tooltip": "Unique string-style identifier"
|
"Website URL - Tooltip": "Unique string-style identifier"
|
||||||
},
|
},
|
||||||
|
@ -249,6 +249,8 @@
|
|||||||
"New Organization": "添加组织",
|
"New Organization": "添加组织",
|
||||||
"Soft deletion": "软删除",
|
"Soft deletion": "软删除",
|
||||||
"Soft deletion - Tooltip": "启用后,删除用户信息时不会在数据库彻底清除,只会标记为已删除状态",
|
"Soft deletion - Tooltip": "启用后,删除用户信息时不会在数据库彻底清除,只会标记为已删除状态",
|
||||||
|
"Tags": "标签集合",
|
||||||
|
"Tags - Tooltip": "可供用户选择的标签的集合",
|
||||||
"Website URL": "网页地址",
|
"Website URL": "网页地址",
|
||||||
"Website URL - Tooltip": "网页地址"
|
"Website URL - Tooltip": "网页地址"
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user