grim/hgkeeper
Clone
Summary
Browse
Changes
Graph
Remove the mercurial 6.1 pin from the container image
22 months ago, Gary Kramlich
653b933ba715
Remove the mercurial 6.1 pin from the container image
package
access
import
(
"path/filepath"
"sync"
"github.com/casbin/casbin/v2"
log
"github.com/sirupsen/logrus"
)
var
(
enforcer
*
casbin
.
Enforcer
enforcerLock
sync
.
Mutex
)
func
refreshEnforcer
()
error
{
enforcerLock
.
Lock
()
defer
enforcerLock
.
Unlock
()
modelFile
:=
filepath
.
Join
(
AdminRepoPath
(),
modelFilename
)
policyFile
:=
filepath
.
Join
(
AdminRepoPath
(),
policyFilename
)
log
.
Debugf
(
"reading model from %q"
,
modelFile
)
log
.
Debugf
(
"reading policy from %q"
,
policyFile
)
e
,
err
:=
casbin
.
NewEnforcer
(
modelFile
,
policyFile
)
if
err
!=
nil
{
log
.
Errorf
(
"failed to create new enforcer: %v"
,
err
)
return
err
}
enforcer
=
e
return
nil
}