mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-02 19:40:19 +08:00
Add MasterPassword to organization.
This commit is contained in:
@ -31,6 +31,7 @@ type Organization struct {
|
||||
PasswordSalt string `xorm:"varchar(100)" json:"passwordSalt"`
|
||||
PhonePrefix string `xorm:"varchar(10)" json:"phonePrefix"`
|
||||
DefaultAvatar string `xorm:"varchar(100)" json:"defaultAvatar"`
|
||||
MasterPassword string `xorm:"varchar(100)" json:"masterPassword"`
|
||||
EnableSoftDeletion bool `json:"enableSoftDeletion"`
|
||||
}
|
||||
|
||||
@ -86,6 +87,24 @@ func GetOrganization(id string) *Organization {
|
||||
return getOrganization(owner, name)
|
||||
}
|
||||
|
||||
func GetMaskedOrganization(organization *Organization) *Organization {
|
||||
if organization == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
if organization.MasterPassword != "" {
|
||||
organization.MasterPassword = "***"
|
||||
}
|
||||
return organization
|
||||
}
|
||||
|
||||
func GetMaskedOrganizations(organizations []*Organization) []*Organization {
|
||||
for _, organization := range organizations {
|
||||
organization = GetMaskedOrganization(organization)
|
||||
}
|
||||
return organizations
|
||||
}
|
||||
|
||||
func UpdateOrganization(id string, organization *Organization) bool {
|
||||
owner, name := util.GetOwnerAndNameFromId(id)
|
||||
if getOrganization(owner, name) == nil {
|
||||
|
Reference in New Issue
Block a user