fix: fix the problem that user owner is not updated when updating organization name (#775)

* fix: use openid or unionid as username rather than nickname when logging with WeChat
FIX #762

* fix: fix the problem that user owner is not updated when updating organization name

* Update wechat.go

Co-authored-by: Gucheng <85475922+nomeguy@users.noreply.github.com>
This commit is contained in:
caoshengdong 2022-06-03 00:37:22 +08:00 committed by GitHub
parent 88c5aae9e9
commit 604e2757c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -121,11 +121,15 @@ func UpdateOrganization(id string, organization *Organization) bool {
}
if name != organization.Name {
applications := GetApplicationsByOrganizationName("admin", name)
for _, application := range applications {
go func() {
application := new(Application)
application.Organization = organization.Name
UpdateApplication(application.GetId(), application)
}
_, _ = adapter.Engine.Where("organization=?", name).Update(application)
user := new(User)
user.Owner = organization.Name
_, _ = adapter.Engine.Where("owner=?", name).Update(user)
}()
}
if organization.MasterPassword != "" && organization.MasterPassword != "***" {