casbin / gorm-adapter

GORM adapter for Casbin, see extended version of GORM Adapter Ex at: https://github.com/casbin/gorm-adapter-ex
https://github.com/casbin/casbin
Apache License 2.0
692 stars 207 forks source link

panic recovered: interface conversion: *gormadapter.Adapter is not persist.UpdatableAdapter: missing method UpdateFilteredPolicies #165

Closed 4927525 closed 2 years ago

4927525 commented 2 years ago

Hello, when running UpdatePolicy this error comes up.

panic recovered: interface conversion: *gormadapter.Adapter is not persist.UpdatableAdapter: missing method UpdateFilteredPolicies

import

import (
    "github.com/casbin/casbin/v2"
    gormadapter "github.com/casbin/gorm-adapter/v2"
    "github.com/jinzhu/gorm"

    _ "github.com/jinzhu/gorm/dialects/mysql"
)

the code that triggers the error:

bool, err := e.UpdatePolicy([]string{userID, roomID, role, "sgsg"}, []string{userID, roomID, role, "sg"})
casbin-bot commented 2 years ago

@tangyang9464 @closetool @sagilio

hsluoyz commented 2 years ago

@4927525 did you use the latest version? Please do that.

hsluoyz commented 2 years ago

@4927525 UpdatableAdapter interface is supported in v3.0.6: https://github.com/casbin/gorm-adapter/issues/65 , please update to latest version