diff --git a/auth/group.go b/auth/group.go index 4bc27e0..bf97cc6 100644 --- a/auth/group.go +++ b/auth/group.go @@ -33,17 +33,26 @@ func (grp *Group) BeforeSave(tx *gorm.DB) (err error) { if grp.DisplayName == "" { grp.DisplayName = strings.TrimPrefix(grp.Name, SYS_AUTH_PREFIX) } - return BeforeGroupSave(grp, tx) + if BeforeGroupSave != nil { + err = BeforeGroupSave(grp, tx) + } + return } var BeforeGroupUpdate func(*Group, *gorm.DB) error = nil func (grp *Group) BeforeUpdate(tx *gorm.DB) (err error) { - return BeforeGroupUpdate(grp, tx) + if BeforeGroupUpdate != nil { + err = BeforeGroupUpdate(grp, tx) + } + return } var BeforeGroupDelete func(*Group, *gorm.DB) error = nil func (grp *Group) BeforeDelete(tx *gorm.DB) (err error) { - return BeforeGroupDelete(grp, tx) + if BeforeGroupDelete != nil { + err = BeforeGroupDelete(grp, tx) + } + return }