casbin / jcasbin

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

adapter addPolicy should after model.addPolicy ? #41

Closed wzhj2326 closed 4 years ago

wzhj2326 commented 5 years ago

org.casbin.jcasbin.main.InternalEnforcer.java // When the added policy exists, it will cause repeated additions in the storage. thanks.

fangzhengjin commented 5 years ago

For historical reasons, the current rule deduplication is done by the adapter. You can refer to the method loadPolicy - transformToCasbinRule custom adapter for processing. We will adjust this feature in a later version.

hsluoyz commented 4 years ago

@tldyl please follow how Golang Casbin did: https://github.com/casbin/casbin/pull/490 to fix this issue.