Skip to content

Commit

Permalink
fixed: casbin 设置空权限无需调用 AddPolicies 方法 (flipped-aurora#1850)
Browse files Browse the repository at this point in the history
  • Loading branch information
SliverHorn authored Aug 12, 2024
1 parent 6fedb97 commit c3c049b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions server/service/system/sys_casbin.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ func (casbinService *CasbinService) UpdateCasbin(AuthorityID uint, casbinInfos [
rules = append(rules, []string{authorityId, v.Path, v.Method})
}
}
if len(rules) == 0 {
return nil
} // 设置空权限无需调用 AddPolicies 方法
e := casbinService.Casbin()
success, _ := e.AddPolicies(rules)
if !success {
Expand Down

0 comments on commit c3c049b

Please sign in to comment.