We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a8caeb7 commit 05d560cCopy full SHA for 05d560c
server/service/system/sys_authority.go
@@ -64,16 +64,16 @@ func (authorityService *AuthorityService) CopyAuthority(copyInfo response.SysAut
64
if err != nil {
65
return
66
}
67
- for i := range btns {
68
- btns[i].AuthorityId = copyInfo.Authority.AuthorityId
69
- }
70
-
71
- err = global.GVA_DB.Create(&btns).Error
+ if len(btns) > 0 {
+ for i := range btns {
+ btns[i].AuthorityId = copyInfo.Authority.AuthorityId
+ }
+ err = global.GVA_DB.Create(&btns).Error
72
73
- if err != nil {
74
- return
+ if err != nil {
+ return
75
76
77
paths := CasbinServiceApp.GetPolicyPathByAuthorityId(copyInfo.OldAuthorityId)
78
err = CasbinServiceApp.UpdateCasbin(copyInfo.Authority.AuthorityId, paths)
79
0 commit comments