panic serving [::1]:35256: interface conversion: *xormadapter.Adapter is not persist.UpdatableAdapter: missing method UpdatePolicies
goroutine 23 [running]:
net/http.(*conn).serve.func1(0xc0002981e0)
/snap/go/current/src/net/http/server.go:1824 +0x14c
panic(0xb14e60, 0xc0003d6ba0)
/snap/go/current/src/runtime/panic.go:971 +0x4c7
github.com/casbin/casbin/v2.(*Enforcer).updatePolicy(0xc00038a780, 0xb8e9f8, 0x1, 0xb8e9f8, 0x1, 0xc0003d6b40, 0x3, 0x3, 0xc0003d6b70, 0x3, ...)
/home/kserrano/go/pkg/mod/github.com/casbin/casbin/v2@v2.25.5/internal_api.go:154 +0x1d5
github.com/casbin/casbin/v2.(*Enforcer).UpdateNamedGroupingPolicy(0xc00038a780, 0xb8e9f8, 0x1, 0xc0003d6b40, 0x3, 0x3, 0xc0003d6b70, 0x3, 0x3, 0xe73500, ...)
/home/kserrano/go/pkg/mod/github.com/casbin/casbin/v2@v2.25.5/management_api.go:314 +0xd8
github.com/casbin/casbin/v2.(*Enforcer).UpdateGroupingPolicy(0xc00038a780, 0xc0003d6b40, 0x3, 0x3, 0xc0003d6b70, 0x3, 0x3, 0x0, 0x0, 0x0)
/home/kserrano/go/pkg/mod/github.com/casbin/casbin/v2@v2.25.5/management_api.go:310 +0xbe
nessie.xyz/authorization/internal/models.UpdateMember(0xc00051c1a0, 0xc0002a4290, 0x6, 0xc0002a42b0, 0xa, 0xc0002a42c0, 0xb, 0xc0002a4296, 0x6, 0xc0002a42a0, ...)
go 1.15
require (
github.com/casbin/casbin/v2 v2.25.5
github.com/casbin/xorm-adapter/v2 v2.2.0
github.com/go-sql-driver/mysql v1.5.0
)
Description
Panic error when trying to use the function UpdateGroupingPolicy() or UpdateNamedGroupingPolicy()
The
xormadapter.Adaptercannot be converted topersist.UpdatableAdapterbecause of missing functionUpdatePolicies()in the xorm-adapterstacktrace
Versions
Using the following versions for Casbin and Adapter (extracted from
go.modfile)Casbin v2.25.5 (latest as of today)
xorm-adapter v2.2.0 (latest as of today)