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.
2 parents 7139b67 + e4ee942 commit 40f995bCopy full SHA for 40f995b
server/service/sys_casbin.go
@@ -91,8 +91,9 @@ func ClearCasbin(v int, p ...string) bool {
91
//@return: *casbin.Enforcer
92
93
var (
94
- e *casbin.Enforcer
95
- once sync.Once
+ e *casbin.Enforcer
+ once sync.Once
96
+ eLock sync.Mutex
97
)
98
99
func Casbin() *casbin.Enforcer {
@@ -101,7 +102,9 @@ func Casbin() *casbin.Enforcer {
101
102
e, _ = casbin.NewEnforcer(global.GVA_CONFIG.Casbin.ModelPath, a)
103
e.AddFunction("ParamsMatch", ParamsMatchFunc)
104
})
105
+ eLock.Lock()
106
_ = e.LoadPolicy()
107
+ eLock.Unlock()
108
return e
109
}
110
0 commit comments