fix: check enforcer should not be nil (#2199)

* fix: check enforcer should not be nil

* fix: check enforcer should not be nil

* Update user.go

---------

Co-authored-by: hsluoyz <hsluoyz@qq.com>
This commit is contained in:
Yaodong Yu
2023-08-11 12:31:49 +08:00
committed by GitHub
parent 1a9d02be46
commit 9899022bcd
4 changed files with 19 additions and 24 deletions

View File

@ -34,11 +34,7 @@ const UserEnforcerId = "built-in/user-enforcer-built-in"
var userEnforcer *UserGroupEnforcer
func InitUserManager() {
enforcer, err := GetEnforcer(UserEnforcerId)
if err != nil {
panic(err)
}
err = enforcer.InitEnforcer()
enforcer, err := GetInitializedEnforcer(UserEnforcerId)
if err != nil {
panic(err)
}