casbin / jcasbin

An authorization library that supports access control models like ACL, RBAC, ABAC in Java
https://casbin.org
Apache License 2.0
2.4k stars 464 forks source link

jcasbin DefaultRoleManager should provider some funcs (AddMatchingFunc,AddDomainMatchingFunc) just like golang #204

Closed rongfengliang closed 3 years ago

rongfengliang commented 3 years ago

just like golang version

e, err := casbin.NewEnforcer("model.conf", "policy.csv")
    if err != nil {
        log.Print(err.Error())
    }
    e.AddFunction("mydemo", KeyMatchFunc)
    r := e.GetRoleManager()
    r.(*defaultrolemanager.RoleManager).AddDomainMatchingFunc("mydemo", MyKeyMatch)
    pers, _ := e.GetImplicitPermissionsForUser("alice", "domain2")

current without those func , if we want change default rbac function we should pass one and then call loadPolicy if we forget call loadPolicy , jcasbin will not working as golang version

hsluoyz commented 3 years ago

@shink

github-actions[bot] commented 3 years ago

:tada: This issue has been resolved in version 1.12.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: