master
Evan Chen 2021-12-19 21:30:50 +08:00
parent 93c09aa414
commit 7951de705e
1 changed files with 3 additions and 1 deletions

View File

@ -24,11 +24,13 @@ type Group struct {
UpdatedAt time.Time
}
var BeforeGroupSave func(*Group) error = func(g *Group) error { return nil }
func (grp *Group) BeforeSave(tx *gorm.DB) (err error) {
// set displayname
if grp.DisplayName == "" {
grp.DisplayName = strings.TrimPrefix(grp.Name, SYS_AUTH_PREFIX)
}
return
return BeforeGroupSave(grp)
}