Skip to content

Commit

Permalink
fix: fix the problem that user owner is not updated when updating org…
Browse files Browse the repository at this point in the history
…anization name (beego#775)

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

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

* Update wechat.go

Co-authored-by: Gucheng <[email protected]>
  • Loading branch information
caoshengdong and nomeguy authored Jun 2, 2022
1 parent 88c5aae commit 604e275
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions object/organization.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 != "***" {
Expand Down

0 comments on commit 604e275

Please sign in to comment.