feat: add deletedTime to user (#2652)

This commit is contained in:
Satinder Singh
2024-01-30 07:18:32 -08:00
committed by GitHub
parent 721a681ff1
commit ef373ca736
9 changed files with 20 additions and 1 deletions

View File

@ -49,6 +49,7 @@ type User struct {
Name string `xorm:"varchar(100) notnull pk" json:"name"`
CreatedTime string `xorm:"varchar(100) index" json:"createdTime"`
UpdatedTime string `xorm:"varchar(100)" json:"updatedTime"`
DeletedTime string `xorm:"varchar(100)" json:"deletedTime"`
Id string `xorm:"varchar(100) index" json:"id"`
ExternalId string `xorm:"varchar(100) index" json:"externalId"`
@ -658,6 +659,10 @@ func UpdateUser(id string, user *User, columns []string, isAdmin bool) (bool, er
columns = append(columns, "updated_time")
user.UpdatedTime = util.GetCurrentTime()
if len(user.DeletedTime) > 0 {
columns = append(columns, "deleted_time")
}
if util.ContainsString(columns, "groups") {
_, err := userEnforcer.UpdateGroupsForUser(user.GetId(), user.Groups)
if err != nil {