redis-adapter
redis-adapter copied to clipboard
updatePolicies is not supported in redis-adapter
Hi, When I am trying to use updatePolicies API it gives me the following exception:
panic: interface conversion: *redisadapter.Adapter is not persist.UpdatableAdapter: missing method UpdateFilteredPolicies
goroutine 1 [running]:
github.com/casbin/casbin/v2.(*Enforcer).updatePolicies(0xc000144400, {0x6bef5b, 0x1}, {0x6bef5b, 0x1}, {0xc00015c540, 0x2, 0x2}, {0xc00015c570, 0x2, ...})
/root/go/pkg/mod/github.com/casbin/casbin/[email protected]/internal_api.go:204 +0x11a
github.com/casbin/casbin/v2.(*Enforcer).UpdateNamedPolicies(...)
/root/go/pkg/mod/github.com/casbin/casbin/[email protected]/management_api.go:253
github.com/casbin/casbin/v2.(*Enforcer).UpdatePolicies(0xc00013dd58?, {0xc00015c540?, 0x6bef5b?, 0x1?}, {0xc00015c570?, 0xc000024240?, 0x20?})
/root/go/pkg/mod/github.com/casbin/casbin/[email protected]/management_api.go:249 +0x4f
main.(*Role).updatepolicy(0xc00013de18, {0x6bff99, 0x8}, {0x6bf711, 0x6}, 0x0)
@tangyang9464 @JalinWang @imp2002
@JalinWang
/cc @tangyang9464
Changes in the adapter interface cause this:
https://github.com/casbin/casbin/commit/e3538fbf41846be5c5d0dbfcfb5149d6b3f8f49e#diff-ccf7c777bfd057d317dca5b3baa62bfdcca0121745391d55bc6bdbcbb2e04c2bR25-R26
Redis-adapter doesn't catch up with it. I'll fix it.
If this block you, you can switch to other adapters first for development, e.g., https://github.com/casbin/xorm-adapter. The migration is easy.
@JalinWang plz implement UpdateFilteredPolicies() for this adapter, or if not possible, provide an empty implementation