add hook
parent
93c09aa414
commit
7951de705e
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue