From ea1c75f0e7ef337188684c3d8780ab5379048db3 Mon Sep 17 00:00:00 2001 From: Evan Chen Date: Sun, 19 Dec 2021 22:03:33 +0800 Subject: [PATCH] update --- auth/group.go | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) 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 }