Run sync user job if configured.

This commit is contained in:
Gucheng Wang
2021-11-11 00:50:08 +08:00
parent f5fdf0af6a
commit 37829062ad
5 changed files with 25 additions and 17 deletions

View File

@ -21,6 +21,7 @@ import (
_ "github.com/astaxie/beego/session/redis"
"github.com/casbin/casdoor/authz"
"github.com/casbin/casdoor/object"
"github.com/casbin/casdoor/original"
"github.com/casbin/casdoor/proxy"
"github.com/casbin/casdoor/routers"
@ -34,6 +35,10 @@ func main() {
proxy.InitHttpClient()
authz.InitAuthz()
if original.InitAdapter() {
go original.RunSyncUsersJob()
}
beego.InsertFilter("*", beego.BeforeRouter, cors.Allow(&cors.Options{
AllowOrigins: []string{"*"},
AllowMethods: []string{"GET", "PUT", "PATCH"},